I just googled
stepper motor with end stops
and there is much discussion you might benefit from.
Does the program you posted above operate the stepper motor?
It looks like it would turn 90 degrees one way, pause then turn 90 degrees the other way.
Have you written any programs at all? If not, you should just start with buttons and LEDs and the examples in the IDE, very easy and basic things you will need to know.
If you have written some more advanced programs, even a little bit, you should be able to get something working, we can help with your efforts.
But first describe as best you can the overall goal of the current experiment or project that you are working on. Just in plain terms (English, haha) what the program is supposed to do, and what inputs or other information is going to control the stepper motor.
a7