It is not clear, what you are asking for, but the first point where you should search is in the
NewPing documentation.
Tip: for clear code it is state of art to write the headers at top, and than implement and initialize like that:
#include <servo.h>;
#include <newping.h>
#define echopin 11 //set echopin (I hope you know why that value)
#define trigpin 12 //set trigpin (I hope you know why that value)
const int MAX_DISTANCE = 400;Servo robotArm;
NewPing sonar(trigpin, echopin, MAX_DISTANCE);
int distance = MAX_DISTANCE;