A square wave is the sum of an infinite series of sine waves, having a fundamental and harmonics of higher frequencies. The fundamental can be seperated from the rest of the harmonics by filtering it out using multiple stages of a low pass filter. Here, I'm using 4 stages of a 2nd order active low pass filter. All stages, except the third, have a passband gain of 1. The third stage has a passband gain of 2 to boost the voltage of the obtained sine wave, as it too gets attenuated by the filter due to the fact that it lies near the cut-off frequency. Note that the square wave has a frequency of 1kHz, which means that it has a fundamental sine wave of 1kHz frequency and is seen at the output. Adding anymore filter stages will yield diminishing returns.