How to connect Arduino output pin to Line-In

This link might be useful (the 2nd circuit is the one): Tuto:Get analog audio(3.5mm Audio Jack) in Raspberry Pi Zero - Raspberry Pi Forums

I would increase the 0.1uF values to 0.47uF or 1uF and run PWM at an ultrasonic rate (20kHz or above).