ultrasonic sensors works fine until i merge codes into it

Not only that one... (oh, and do make those ints for pin declaration into const byte like you use later - much more efficient).

int led1 = 2;
int led2 = 3;
int led3 = 4;
int led4 = 5;

const byte echoPin = 2; // Arduino pin tied to echo pin on the ultrasonic sensor 1.
const byte trigPin = 3; // Arduino pin tied to trigger pin on the ultrasonic sensor 1.
const byte echo2Pin = 4; // Arduino pin tied to echo pin on the ultrasonic sensor 2.
const byte trig2Pin = 5; // Arduino pin tied to trigger pin on the ultrasonic sensor 2.

Trig pins can be shared with an LED (wouldn't know why you'd do that unless when seriously running out of pins, but it can be done if you're really careful), echo pins definitely not.