How to update or add string at the end of a line

Hello Guys,

I want to add /append a line using anisble .How can this be achieved. I have tried the lineinfile module ,but it dosen’t seem to work .Is there a better way to do that ,Below is what I need to achieve

Regards,
Salil

Hello

Below is what I need to achieve

i think you forgot to give your requirements. if you can provide what exactly you need it will be easy to answer.

you can use blockinfile module if you want to insert/update/remove a block of lines in a file, for more understanding please follow this link: http://docs.ansible.com/ansible/latest/blockinfile_module.html

or if you want to add a line after any line you can use these settings:

- lineinfile:
    path: <file path>
    regexp: '^your line '
    insertafter: '^#your line '
    line: 'your line'