Step 1: Base Specifications
Step 2: Programing
() = loop,  = condition
wait [ultrasonic, closer than 20 in]
move back right
wait [ultrasonic, farther than 30 in]
you might have to play around with the distances there depending on available space and your robots size but other than that your good.
if you want a bit of a challenge, (its not that hard but its still kinda tricky if your a beginner) you may have noticed the touch sensors on my robot, that way if i run into a wall instead of moving the right motor back it moves the left one, if both sensors are touched it moves forward a few inches and turns back right again. good luck!