did you mean “P2.0. when switch ON A is transmit infinite times and whent it is OFF B is transmit infinite times”.
You have written “off” only !!
What you can do is once an ON condition is detected send A and wait till the condition becomes OFF, and once it is OFF send B and wait till the ON condition is detected. Repeat this in a loop.
The following code is just to give you an idea;
while ( 1 )
while (OFF); // wait till ON is detected, the condition fails and go to next statement
while (ON); // wait till OFF is detected, the condition fails and go to next statement