Draw rows of squares pattern

Please edit your previous posts to format your code, it is not readable as is.

Regarding your problem, you just need to change one line of your code to get the desired effect.

Just after changing the Y position -> meaning that you are changing the line, you need to set your X position to the initial value (aka 1). It is as simple as that. Almost there!