Fix quoting issues in lineinfile for individual single-quotes

Fixes #8806