no synchronization between xbee

i have to xbee S2 , one as a coordinator API connected to an arduino and the other a router AT, my project is about sending a command to the router to light up a led. the coordinator send the data if i clicked a button. the problem is the router don’t react immediately it takes a while to receive the data. can anyone help me please.

int led = 13;
const int bouton = 2;
void setup() {
  // put your setup code here, to run once:
pinMode(led, OUTPUT);
Serial.begin(115200);
pinMode(bouton, INPUT);
}
void loop() {
  // put your main code here, to run repeatedly:
   if(digitalRead(bouton)==HIGH)
  {
    digitalWrite(led,HIGH);
    setRemoteState(0x5);
    delay(10);
  }
     if(digitalRead(bouton)==LOW)
  {
      digitalWrite(led,LOW);
      setRemoteState(0x4);
      delay(10);
  
  }
}
void setRemoteState(char value){
  Serial.write(0x7E); // start byte
  Serial.write((byte)0x0);
  Serial.write(0x10);
  Serial.write(0x17);
  Serial.write((byte)0x0);
  // id of recipient or use 0xFFFF for broadcast
  Serial.write((byte)00);
  Serial.write((byte)00);
  Serial.write((byte)00);
  Serial.write((byte)00);
  Serial.write((byte)00);
  Serial.write((byte)00);
  Serial.write(0xFF);
  Serial.write(0xFF);
  // 16 bit of reciepent 
  Serial.write(0xFF);
  Serial.write(0xFE);  
  
   Serial.write(0x02); 
   
   Serial.write('D');
   Serial.write('2');
   
   Serial.write(value);
   
   long sum = 0x17 + 0xFF + 0xFF + 0xFF + 0xFE + 0x02 + 'D' + '2' + value;
   Serial.write(0xFF - ( sum & 0xFF) );
   Serial.print(sum,HEX);
}
   
   

Do you have the same issue when sending the data packets from XCTU? If not, then you have something in your returnees in your Arduino.