This is what I did
I expected a nice square wave on my soundcard oscilloscope software but I'm getting this
What is happening ?
AC Coupling.
Sound cards have a capacitor in series with the input which acts as a high pass filter, removing frequencies lower than around 20Hz.
You appear to be feeding in a signal of only 2Hz which is basically going to get filtered into nothing more than an impulse response at each transition as you are seeing. The reason you see the impulse is that a step change in the signal voltage has a large bandwidth requirement - having many higher order harmonics which will not be filtered out.