Makes replace_or_add function properly

When the regex matches a line in the target file, we now properly
compare it against a *newline-terminated* version of
new_resource.line to determine if the line is correct or needs
to be updated.

When the regex is not matched, and so the file is not modified,
we are in "add" mode and spit out new_resource.line to the
open temp file. This was mistakenly spitting out to the original
file (and silently failing as it was only open for r+ ... but it
was the wrong place to write anyway - remnant from previous code)