AT Command with AVR

I wanna change from AT Mode to API mode using AVR.
Can I transmit the following packets to Xbee to do that work ?

unsigned char bufadd[3] = {0x2B,0x2B,0x2B};
unsigned char bufapi[6] ={0x41,0x54,0x41,0x50,0x31,0x0D};
unsigned char bufatwr[5]={0x41,0x54,0x57,0x52,0x0D};
unsigned char bufatcn[5] = {0x41,0x54,0x43,0x4E,0x0D};

for(k=0;k<3;k++) putchar1(bufadd[k]);
for(k=0;k<6;k++) putchar1(bufapi[k]);
for(k=0;k<5;k++) putchar1(bufatwr[k]);
for(k=0;k<5;k++) putchar1(bufatcn[k]);

I actually sent those packages to Xbee via AVR but Xbee didnt understand.