how to transmit and receive the packets simultaneously from the xbee connected to raspberrypi.

That is going to be something you are going to need to look up in the Code Disposataries for the Rasberry Pi.