Command line ranges can be use to select a specific line that needs to be edited. Then substitute pattern can be used to perform the edit (append).
For example, to append text "hi" at the begining of line 3:
vim -c "3 s/^/hi/" -c "wq" file.txt
To append text "hi" at the end of line 3:
vim -c "3 s/$/hi/" -c "wq" file.txt
To find more options and explanations:
vim -c "help cmdline-range"
Some more examples
To find a search string "hi" and append string " everyone" on line 3:
vim -c "3 s/\(hi\)/\1 everyone/" -c "wq" file.txt
To find a search string "hi" and prepend a string "say " on line 3:
vim -c "3 s/\(hi\)/say \1/" -c "wq" file.txt
In case the line number is not known, To search anyappend first occurrences of string "hi" in file and append iton every line with " all":
vim -c "1,$ s/\(hi\)/\1 all/" -c "wq" file.txt
To append all occurrences of string "hi" on every line with " all":
vim -c "1,$ s/\(hi\)/\1 all/g" -c "wq" file.txt
For more info about substitutions:
vim -c "help substitute"