This is the code for appending string to a specific line number:
sed -e '1s/$/has/' -i testapend.txt
However, how would you be able to do the same thing but using a variable for the string and for the line number (int)?
I have so far tried inserting $variable into the slashes and chucking in braces, but it either says unknown command or extra characters after the command.