The previous implementation used bufio.NewWriter which could split a
single entry into multiple write() syscalls. Under concurrent O_APPEND
from multiple goroutines, these partial writes interleave, producing
corrupted lines that the scanner silently drops.
Fix: encode into a bytes.Buffer first, then issue a single f.Write()
call. For payloads under PIPE_BUF (4096 bytes on Linux), this is
guaranteed atomic by POSIX.
Fixes flaky TestAppend_ConcurrentWritersUniqueIDs in CI.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>