Sed is a really awesome part of linux, allowing to insert and amend text where ever you can find it! Had some niggles trying to get it to like my bash variable though however with the below I got it to do the trick, seems to be those pesky quotation marks that are causing problems!!
Added an example below which will post a variable in between an XML tag, handy for working with APIs or other craziness.
<somexmltaghere>PLEASE INSERT ME HERE :d!!<somexmltaghere>
sed 's/<\/somexmltaghere>/'"$variablehere"'&/' test.xml