Sorry, but I can not reproduce it locally with your snippet.
After I added the missing pieces (
import (…), and
const (…), I was able to compile and run.
echo "test" | nc localhost 3333 resulted created the expected output as well as it created the file, it contents was:
$ cat output.txt | xxd
00000000: 7465 7374 0a test.
Perhaps you are looking for the file in the wrong place and that one you are looking it is a leftover?
Please check the various dates a file in linux can have. Especially the mdate.