To insert an content after an element, you may find the the element to be inserted after, and use insertBefore method to insert the content with the nextSibling property. The next example is insert a horizontal line after the element 'main'.
var main, newElement;
main = document.getElementById('main');
if (main) {
newElement = document.createElement('hr');
main.parentNode.insertBefore(newElement, main.nextSibling);
}