Serial.read() doesnt work in IF statement
Your problem is that you are assuming that all you see in the Serial Monitor is all there is. You see "OK", so you expect to compare the text that comes in with "OK".

However it's not. Serial communication (at least, text based serial communication) generally includes some kind of line ending marker. That could be any combination of Carriage Return (\r) and/or Line Feed (\n). Different devices use different combinations.

As it turns out the XBee uses '\r' as the line ending marker.

There are two ways of dealing with it:


Include the line ending in your comparison ("OK\r"), or better,
Incorporate the line ending in the reading.


The second point there involves the use of readStringUntil():

String x = xbeeSerial.readStringUntil('\r');


That is a more reliable way of reading the response since it reads everything up to the line ending, rather than reading until it times out with nothing else to read. You should find your whole program runs smoother with that method.