Can I make this code shorter?

Is there a code, so that the Arduino understand that the stepper motor has reach it's end (not moving anymore)?
Or do I need a limit switch or to measure the current to the motor?

No, there is no way for the Arduino to know that the stepper is not able to step any more. You need a limit switch or a way to measure current draw to detect a stall (the limit switch is better).