Use the $a syntax and sed:
sed -i -e "$a some text" filename
-i parameter means in place.
A previous post explained how to insert a line anywhere but for completeness here it is again:
sed -i -e "2i some text on second line" filename
Please follow and like us: