Start by looking at the examples in the iDE to see the required structure of an Arduino sketch, then look at the Sensors/Ping example to see how to use that sensor.
I do not know what sensor you are using, but when you purchase from Arduino, Adafruit, Sparkfun and other dealers you should have access to sample sketches like: https://www.sparkfun.com/tutorials/263
If not, and it is a common sensor, a Google search is often rewarding:
Your pseudo code is quiet good, translating to real Arduino syntax will not be too difficult. You start by reviewing the core instructions:
Then drill down to review the command details.
So, I would start with working code for the ultrasonic unit, ADD my code to control 2 LEDs instead of the motors. Get all of that working and then work with adding in the motor logic.