Problems with changing baud rate - device connected to Arduino Uno

Hi,

Thanks for the remark,
Here is my updated code:

#include <SoftwareSerial.h>

SoftwareSerial GPS_Serial(11,12);
// pin 11 is the Rx of Ardoino. Connected to the Tx of GNSS module
// pin 12 is the Tx of Ardoino. Connected to the Rx of GNSS module

String str = "";
int Baud_Rate = 4800;   // initial baud rate - default of the module

void setup()
{
    Serial.begin(Baud_Rate);
    GPS_Serial.begin(Baud_Rate);
    Serial.println("connection established");         
}

void(* resetFunc) (void) = 0; //declare reset function @ address 0

void loop()
{  
    //if we have some incomming serial data then..
    if (GPS_Serial.available())
    {
      Serial.write(GPS_Serial.read()); 
    }

    while (Serial.available())
    {
      char c = Serial.read();
      str += c; 
      if (c =='\n')
      {
        if (str.indexOf("$PSRF100,1,9600,8,1,0*0D") >= 0 )
        {
 
         GPS_Serial.print(str);
         GPS_Serial.flush();
         delay(1000);
         GPS_Serial.end();
         Serial.flush();
         delay(2000);
      // Serial.end();         // Tried with and without this line          

         Baud_Rate = 9600;
         resetFunc();                    //call reset.   Tried at first without making reset.

         setup();
        }


     else
        {
          GPS_Serial.print(str);          
        }
        str="";
      }
    }

}