It is very simple, you can use the method setCursor() described here .
Code example:
function setCursorToStart() {
var doc = DocumentApp.getActiveDocument();
var paragraph = doc.getBody().getChild(0);
var position = doc.newPosition(paragraph.getChild(0), 0);
doc.setCursor(position);
}
, , , , , , :
function insertTextOnTop() {
var doc = DocumentApp.getActiveDocument();
var top = doc.getBody().getChild(0);
top.asParagraph().insertText(0,'text to insert');
doc.saveAndClose();
}