Set correct permissions on <dest> file creation

The creation of a new output file each time the config changes causes problems with its ownership and permissions; when the output file is on a Docker volume.
Without doing additional user adding/user space mapping stuff, Docker writes the file as root:root and 0600, which for all sense and purposes makes it unreadable for everything else.
If a file already exists, then the file's ownership and permissions are left untouched by Docker.

I couldn't see why a temp file was being used so this patch removes the use of it, and instead will truncate and overwrite the existing file.