I found it out myself:
import kate
from kate import documentManager as dm
from PyKDE4.kdecore import KUrl
text = "Lorem ipsum dolor sit amet"
# Open a new empty document
doc = dm.openUrl(KUrl())
# Open an existing file
doc = dm.openUrl(KUrl('/path/to/file.ext'))
# Activate view
kate.application.activeMainWindow().activateView(doc)
# Insert text
pos = kate.activeView().cursorPosition()
doc.insertText(pos, text)