How will Arduino communicate wirelessly through XBee?
Pin 2 &amp; 3 are hardware serial pins.
You can't/shouldn't attach softwareserial pins to them.

In short, your SoftwareSerial XBee is never used and uses the same pins of the hardware serial.

What are you actually trying to achieve? I have a hard time understanding it.
Though. You should first check if your connection is working.

What devices do you have connected to the arduino?

Is it [Arduino] &lt;-> [XBEE] &lt;-> [PC]?

Test your connection using the code below

int incomingByte = 0;   // for incoming serial data

void setup() {
        Serial.begin(9600);     // opens serial port, sets data rate to 9600 bps
}

void loop() {

        // send data only when you receive data:
        if (Serial.available() &gt; 0) {
                // read the incoming byte:
                incomingByte = Serial.read();

                // say what you got:
                Serial.print("I received: ");
                Serial.println(incomingByte, DEC);
        }
}


Source