Stepper motor moves greater number of steps in forward direction compared to the reverse direction. I tried swapping the wires connected to the driver, but had the same problem.
void loop()
{
//accelStepper.setSpeed(2000);
//accelStepper.runSpeed();
accelStepper.runToNewPosition(0);
delay(500);
accelStepper.runToNewPosition(20000);
delay(500);
}