That is not code for a stepper motor. The analogWrite function can be used to control the speed of a DC motor, not a stepper. To see how to write code to control a stepper see Robin2's simple stepper code tutorial.
Or use a library like the AccelStepper library or the MobaTools stepper library. Both libraries have documentation and example code to help to learn to use them. Personally, I think the MobaTools library easier to learn. Both libraries are available via the IDE library manager.