How to merge three scetches?

@robtillaart has described the process very neatly.

I would make one additional suggestion.

I would put the code from each sketch's loop() into a separate function in the new sketch so it looks like this

void loop() {  // this is the new sketch's loop()
   functionA();
   functionB();
   functionC();
}

void functionA() {
   // code from loop() of sketchA
}

void functionB() {
   // code from loop() of sketchB
}

void functionC() {
   // code from loop() of sketchC
}

This should make it much easier not to get hopelessly confused with the different pieces of code. It will be even easier to follow if you give the functions names that reflect what they do.

Having said all that, it may actually be easier to write your new sketch from scratch just using the existing sketches for guidance.

...R