combining 3 codes

Write a fourth sketch containing the top layer of your completed sketch - the overall behaviour of what you want your robot to do. This sketch will reference functions that haven't been written yet - give them meaningful names: "sound_buzzer", "get_distance", "start moving forward".

You then pull the code out of the other sketches to implement those functions.

To test that top layer, you can implement the underlying functions as just prints to serial and button reads.

For instance, the top layer might be:

void loop() {
  if(i_am_moving() && need_to_stop_moving()) {
    stop_moving();
  }
  else if(!i_am_moving() && need_to_start_moving()) {
    start_moving();
  }
}

the start_moving function will eventually be replaced by something that writes to the servos, but for testing you'd just write

void start_moving() {
  Serial.println("START MOVING");
}

likewise, need_to_start_moving() will eventually read the ultrasound, but for testing you'd just attach a pushbutton to the arduino

boolean need_to_start_moving() {
  return digitalRead(5) == LOW; // for testing
}

You can then test that top layer, the overall logic, by pressing buttons and seeing that the stuff that should get printed out gets printed.

Once that does what it should, you can put in the other bits. These can be tested independently. For instance

boolean need_to_start_moving() {
#ifdef SIMULATE_PIR
  return digitalRead(5) == LOW; // for testing
#else
  // do stuff here to read the PIR and calculate
#endif
}

This allows you to sub in the test pushbutton for the real PIR code, so that you can test the servo on/off code in an isolated way.

That kind of thing.

Build the code in steps. Build it in such a way that the steps can be tested. And don't think in terms of "combining sketches". You don't buy a plane and a boat and attempt to assemble a seaplane from the parts - you design a seaplane. Of course, once you get down to individual bits (eg: the engine) it's just a matter of swapping in the parts you need, but the approach is to start with the idea of a seaplane, then drill down to the components - not the other way around.