It's not really a square wave.
It's a number of dots that belong to a square wave.
Furthermore those lines are not vertical.
You have for instance y(124)=1 and y(125)=-1.
Matlab connects all the dots with lines, and these 2 dots are connected with an almost vertical line.