You should only call Serial.begin() once, during setup(), instead of after receiving each character. Also, since the Serial I/O uses pins 0 and 1 on most boards, and you're also trying to use pin1 for directionPin1, it's possible that the serial I/O is causing the direction to flip while the stepper is moving, so that not all the steps you execute are in the direction you intended. If you're using the hardware Serial port, you should not use the serial Rx and Tx pins for anything else.