Without posting your sketch this question translates to
"Can somebody post a ready to use code that fits my requirements?"
Which you could easily find yourself
arduino+code+steppermotor+limitswitch
If you already have code you want to go on using
then post your complete sketch using this method
best regards Stefan