Having some questions about converting a PWM signal to analogue signal
The fourth picture has a PWM frequency that is more like 600 kHz. Just count a few cycles between 0.3 ms and 0.4 ms (100 us difference). I count at least 6 so the period of one cycle is no more that 1.667 us and that is a frequency that is at least 600 kHz.

At ten times the frequency, the ripple on the output will be ten times less and your sine wave will look far nicer.

I'm not going to go down the path of answering what appear to me as questions that are as a result of your initial lack of understanding about filters. Get your head around this one answer then it should all slip into place.