"The output I receive is serial test start ...
What am I doing wrong?"
You should use /dev/serial0
There seems to be nothing wrong with the program, it is probably doing what you instructed it to do
i.e. Send a line; then read input and resend the characters over serial, presumably producing an infinite loop.
What do you expect it to do?