The switch pins will normally be LOW
while (digitalRead(rightSwitchPin) == LOW) //keep going until limit switch reached
myStepper.step(1); //move right
while (digitalRead(leftSwitchPin) == LOW) //keep going until limit switch reached
myStepper.step(-1); //move left
NOTE 1 - I do not have a stepper motor to try this on. You may need to adjust speed etc
NOTE 2 - The directions may be wrong. If so, swap the 1 and -1 in the step calls.
NOTE 3 - I have changed the names of the switch pins to make it more obvious what is going on