I believe this whole question is based on the misinterpretation of the oscilloscope screenshot shown first, before adding a capacitor & resistor to the LM393 output.
I want to change my square wave signal [...] 5 volts to 0 volts
This is what is shown in the first image anyway!
In the first picture, it is my original square wave coming from the Lm393 comparator, but see its ground level is not in zero references, it is below to zero references
The waveform is in the lower half of the display, but that does not mean it is negative. The ground reference level for channel 1 is the small "1" shown on the left side of the display. Notice that the whole of the waveform is positive with respect to that level.
Above, I have taken the original oscilloscope screenshot image, and circled the ground reference for channel 1 in red. Notice how the whole waveform is positive with respect to that. I have also added a red line which is the imaginary 0 V (ground) level for that image. As you can see, the whole waveform is above that line.
So it seems that you have introduced a new problem by adding your RC circuit, and you do not need that. The original signal is what you wanted, varying between 0 and 5 V approximately, but it was just displayed in an unexpected way so you didn't recognise it.