Then how to program my arduino, so that whenever the data from GPS is available, it should transmit it via XBee and for the remaining time it should Listen to the Serial Port.
It isn't an either/or situation. That's what I'm trying to tell you.
On every pass through loop(), you collect any GPS data. Most of the time there will be none, but occasionally, there will be. You collect that data, each time checking to see if that is the last of the data. If it is, you send that data and clear the array.
On every pass through loop(), you collect any Serial data. Most of there time, there will be none, but occasionally, there will be. If there is, deal with it.
Your loop() function will look like:
while(uart_gps.available() > 0)
// Collect the data
// If the end of a sentence has arrived, send it
if(Serial.available() > 0)
// Read that data
// Do something with it
Notice that there is no mention of time. If time WERE a factor, it would be in the "If the end of the sentence" part, where you would decide that the GPS is sending data to you more often (not the case with your GPS) than you want to forward it.
The code that you already have will go after the appropriate comments above.