# Appending a string at the end of line

**URL:** <https://forum.ansible.com/t/appending-a-string-at-the-end-of-line/31687>\
**Category:** Ansible Project\
**Created:** [November 19, 2019, 11:08pm UTC](https://forum.ansible.com/t/appending-a-string-at-the-end-of-line/31687 "2019-11-19T23:08:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rakesh\_Parida](https://avatars.discourse-cdn.com/v4/letter/r/3ab097/32.png) [@Rakesh\_Parida](https://forum.ansible.com/u/Rakesh_Parida)\
**Post date:** [November 19, 2019, 11:08pm UTC](https://forum.ansible.com/t/appending-a-string-at-the-end-of-line/31687/1 "2019-11-19T23:08:32Z")

</div>

Hi ,

I have a file :

cat test.txt  
Baseline: ABC ABC1 ABC23 ABC24 +ABC33 ABC\_PAD +ABC\_PAD\_CAD

Now i want to add +TEST\_ABC at the end of Line :

Desired O/P :  
Baseline: ABC ABC1 ABC23 ABC24 +ABC33 ABC\_PAD +ABC\_PAD\_CAD +TEST\_ABC

I am using lineinfile module but the string is getting added after the line

Desired O/P :  
Baseline: ABC ABC1 ABC23 ABC24 +ABC33 ABC\_PAD +ABC\_PAD\_CAD +TEST\_ABC

Actual O/P:

Desired O/P :  
Baseline: ABC ABC1 ABC23 ABC24 +ABC33 ABC\_PAD +ABC\_PAD\_CAD  
+TEST\_ABC

Below is the task
