Limit switch with Nema 17 and A4988

Why have you introduced a for loop when there was not one in your previous sketch ? In any case, the code snippet is still writing to the step pin