After the update to 5.22/5.22/533 and also when adding CNAME I noticed that the added text was not starting on a new line but was added behind the last already present line.
To avoid this happening any write to a config file by Pi-hole could use an sed command that checks if there is a newline (\n) present and if not it will add it. Then Pi-hole can add line and it will be always on a new line despite if a user has changed the config file and forgot to add a newline at the end of the file.
As far as I could test it it will not add an newline if the file is empty.
sed command adds
\n at the end of the file only if it doesn’t already end with a newline. So if you run it twice, it will not add another newline:
sed -i -e '$a\' filename