On one Arduino, you have the XBee and the PC both connected to the same port. Having two devices connected to the same serial port is rarely a good idea.
There are several ways to deal with the problems you are having. Simplest would be to use just one Arduino, with the motor connected to it. On the PC end, use something like this: https://www.sparkfun.com/products/9819
Then, assuming that the XBees are configured correctly, the XBee pair simply replaces the wire that you were using before.
Personally, I'd take a hammer and pound those stupid shields you have into tiny pieces. Of all the XBee shields around, they are undoubtedly the worst. I know, I have two of them.
These are far better: https://www.sparkfun.com/products/10854
With them, you have a choice of using hardware serial or software serial to talk to the XBee. Of course, the problem is that the only choice of pins for the software serial instance is pins 2 and 3, which are not supported for SoftwareSerial on the Mega.
Of course, you could jumper from pins 2 and 3 to another pair of hardware serial pins. But, then, you'd need to change the code on both the Arduinos. Which would mean that you couldn't use Firmata. But, so what? No big loss. It isn't rocket science to develop and implement your own protocol for turning a pin off or on. Or for reading the state of a pin.