stepper motor control

You want an if-else statement. If the input is high, undo the steps you've made, else if the input is low, go to the pot position:

#include <Stepper.h>

// change this to the number of steps on your motor
#define STEPS 100

Stepper stepper(STEPS, 8, 9, 10, 11);

// the previous reading from the analog input
int previous = 0;

void setup()
{
  // set the speed of the motor to 30 RPMs
  stepper.setSpeed(150);
  pinMode(1, INPUT);            // This is the input pin
}

void loop()
{
  // get the sensor value
  int potVal = analogRead(0);
  int stpPos = map(potVal, 0, 1023, 0, 100);
  
  // I added this if-else statement
  if (digitalRead(1) == HIGH) {
    stepper.step(-previous);
  }
  else {
    stepper.step(stpPos - previous);
  }
  
  // remember the previous value of the sensor
  previous = stpPos;
}