Using Ultrasonic sensor HC-SR04 and Gps (neogps 6m) together

I am trying to read data from both the sensor and the gps (one by one is ok). The sensors work well individually but the Ultrasonic sensor does not give any output. I am new to arduino so i just mixed the codes from the two examples using NewPing Library and TinyGPS libraries. Here is the code. Please suggest what additions need to be made to the code to make both devices work together.

 *10 to GPS Module TX*
 *09 to GPS Module RX*
// 2. added ultrasound libraries 
 #include <NewPing.h>

#define TRIGGER_PIN  5 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN     4 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 400 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

#include <SoftwareSerial.h>
#include <TinyGPS.h>

SoftwareSerial mySerial(10, 11);

TinyGPS gps;

float gpsdump(TinyGPS &gps);

void setup()  
  // Oploen serial communications and wait for port to open:
  // set the data rate for the SoftwareSerial port

void loop() // run over and over
  bool newdata = false;
  unsigned long start = millis();
  // Every 5 seconds we print an update
  while (millis() - start < 5000) 
    if (mySerial.available()) 
      char c =;
      //Serial.print(c);  // uncomment to see raw GPS data
      if (gps.encode(c)) 
        newdata = true;
        break;  // uncomment to print new data immediately!
  if (newdata) 
    Serial.println("Acquired Data");


float gpsdump(TinyGPS &gps)
  // On Arduino, GPS characters may be lost during lengthy Serial.print()
  // On Teensy, Serial prints to USB, which has large output buffering and
  //   runs very fast, so it's not necessary to worry about missing 4800
  //   baud GPS characters.
   Serial.println(gps.f_speed_kmph()) ;

Please suggest what additions need to be made to the code to make both devices work together.

You need to, somewhere, under some circumstances, read the ultrasonic sensor, and, maybe, do something with the value.

As you haven't explained what the program is supposed to do, you're on your own making the program do whatever it is you want it to do.