Sending Hex Commands Via Xbee

Hi all

I am trying to get an Xbee connected to an Arduino Uno to send a Hex command. The Hex command works perfectly when sent via XCTU but when the button is pressed for the Arduino to send the command via the XBee, nothing happens. Any Suggections?

#include < avr/io.h > 

const int ON = 5;
const int OnLED = 9;

void setup()
{
  pinMode(ON, INPUT);
  pinMode(OnLED, OUTPUT);
  
  digitalWrite(OnLED, HIGH);
  
  Serial.begin(9600);
}

void loop()
{
  int test;
  
  test=digitalRead(ON);
  
  if(test==HIGH)
  {
    Serial.write(0xE0);
    Serial.write(0x00);
    Serial.write(0x04);
    Serial.write(0x02);
    Serial.write(0xE6);
    Serial.println("");
    delay(1000);
}
}
  }

The write.sentences will run when while 5 is high. Shouldn't it?