Use HC-SR04 Ultrasonic Sensor to move a motor

Yes, but you've not shown that you're doing that.