Motion-following device not working - sketch related

The first thing I'd change is to move the 'pulseIn()' statements to immediately after the pulse is sent, as was done in the original sketch. As you have it, both 'pings' are sent, then both measurements are taken together, so each sensor will receive an echo from the other one.

You have one extra 'pinMode()' statement for each sensor to make the pins inputs. That's not necessary, because you already make them inputs immediately after the 'ping'.

Also, you don't need to include the "NewPing" library, since you never use it. (Although it is actually a better way to do ultrasonic ranging.)

Furthermore, I just noticed, you use the same variable to store the results of both pings, so the second result immediately overwrites the first.
You create new local variables called 'duration', 'inches' and 'cm' and use them for both readings, whereas you should use the original independent variables 'Rduration', 'Lduration', 'Rinches', 'Linches'.

And you don't need the 'cm' variable or this at all, since you never use the result:-cm = microsecondsToCentimeters(duration);