Edit in JSFiddle

var container = document.getElementById('container'),
    firstParagraph = document.createElement('p'),
    secondParagraph = document.createElement('p'),
    firstTextNode = document.createTextNode('First'),
    secondTextNode = document.createTextNode('Second');

firstParagraph.appendChild(firstTextNode);
container.appendChild(firstParagraph);

secondParagraph.appendChild(secondTextNode);
container.insertBefore(secondParagraph, firstParagraph);
<div id="container"><div>