How to call AT command on XBee from Arduino
Yes you can modify this on the fly. Make sure you are sending the necessary characters first with the required timing. The default is +++

After Xbee replies "OK" you can send your AT commands. As Swanand said don't forget the 0x0D at the end