CONTROL STEPPER MOTOR ON AND OFF

Beckett:
However I cannot get it to stop

Looking at your code which is designed to make the stepper take 10,000 steps I'm guessing you want to be able to stop it before it has completed all those steps.

A much better approach is to make it move one step at a time and check the sensor between every step using code something like

void loop() {
  checkForBottle();
  checkForEdgeOfLabel();
  if (bottleDetected == true and edgeOfLabelDetected == false) {
     moveOneStep();
  }
}

...R
Stepper Motor Basics
Simple Stepper Code

Planning and Implementing a Program