sed -i '/existing line/a text to be inserted' filename
The above will search the file “filename” for the line “existing line” and then add after it the text “text to be inserted”. Tested on Ubuntu. Fails, as is at least, on OS X as the latter’s version of sed requires a file extension when using the -i flag.
From a post by colucix at http://www.linuxquestions.org/questions/programming-9/echo-text-to-a-specific-line-in-an-existing-file-907412/
“the a (add) command of sed adds the specified text immediately below the line containing the pattern. The -i option edits the file in place so that you can avoid temporary copies.”