your step function is fine
you just need to architect your code to meet your requirements. using a blocking for loop does not meet your requirements.
in post #9 i seqLed () demonstrated how a function can be repeatedly called to execute a sequence. in your case, you just need to keep track of the current step and whether to move or not move