Unable to read/write serial port multiple times

The Arduino code does not compile so I fail to see how it will work even once.

The serial input basics tutorial may be of interest.