Use HC-SR04 Ultrasonic Sensor to move a motor

Sorry, but then I still do not get it.

I know that my function "dist()" returns a value in centimetres, and that much is working. The problem is getting the stepper to move accordingly.