I guess the problem may be related to the fact the
flag variable is not updated within
while loop.
I assume you don't check the SCI status within
message_out() or
DelayHlafSec() functions. The status register is tested just once before first delay and later there is no chance to exit the loop.
I'd suggest you to use rather:
while (!IntStatusSci()){//print message every second
message_out(inData);
DelayHalfSec();
}