How to avoid garbage values received in UART communication
The string needs to be zero terminated so that the sending function, putsUART1, knows when it's reached the end. So make your array one character larger and add a null (zero) at the end.

Something like this:

char Rx[6] ;                      //variable to store rx data
int i;
for(i=0;i&lt;=4;i++)  
{
   while(!DataRdyUART1());       //This check if data is ready to be received
   Rx[i] = getcUART1();         //This get one character from UART

 }
Rx[5] = 0;                  // add null terminator
putsUART1(Rx);              //Putting all the Rx data on UART