Stepper motor CNC shield accelstepper.h

I will try to explain. See the comments.

 // if 1 the stepper has not reached the position so the run function will                               
 // step the stepper but skip over the rest of the code
 // If 0 the stepper has reached the target position and has stopped
 if (x_stepper.run() == 0)  // so the rest of the code will run to load a new speed and position
   {
      delay(250);  // your delay between steps
      Serial.println(index);  
      x_stepper.moveTo(xArray[index]);  // set the next position to the next array position
      x_stepper.setMaxSpeed(xSpeeds[index]);  // set the next speed to the next array position
      index++;  // increment the index for the next step in the sequence
      if (index >= NUM_STEPS)  // if the 6 steps have happened 
      {
         index = 0; // reset the index to 0 to a start a new sequence
      }
   }  //  go back to the top and call run again.  Since a new position and speed have been set
      // the run function will run the stepper at the new speed toward the new position

I hope that that is more clear. If not

No. The index is reset to 0 after the last of the 6 positions has been reached.

The run function must be called over and over to run the stepper. The stepper will only move 1 step if the run function is called and it is time for a step. So to move, say, 200 steps, the run function has to be called at least 200 times and, depending on speed, probably many many more times.