Gate forming
Lm324 is a linear amplifier. If the input signal cannot be saturated or cut off, of course, the signal will be amplified, which is called distortion. The best shaping method of square wave is to use gate circuit. If you want to use 324, you must make it reach saturation cut-off state when you input high level and low level, and you can't let it work in amplification state!