Bugfix for ensure line

Well there is a regression in `ensure_line` previouisly new line was appended by `echo "line contents" >> /file/name`  I omitted the fact that `cat` does not append newline at the end of appended line. 

Fixed it in following commit.