solve bug in serial2file

terminating string with \0 instead of \n