Ultrasonic Sensor and LCD Display code help needed !!

You can't just mash two sketches together. You need to decide what the new sketch is supposed to do. It is quite simple to take the 2nd sketch you posted, and modify it to define the ping pin, and to read the ping sensor, and to print the distance value on the LCD, if that is what the resulting sketch is supposed to do.