I was looking for something similar in my shell script.
This article solved my problem: http://www.theunixschool.com/2012/06/insert-line-before-or-after-pattern.html
The one I used:
awk '/pattern/{print "your text here"}1' $FILE > /tmp/patawk
cp /tmp/patawk $FILE
rm /tmp/patawk