After inspecting the Info editor and little digging in Blender's Python API, I did the following
import bpy
lines = []
reading = True
while reading:
try:
lines.append(input())
except EOFError:
reading = False
# delete everything
bpy.ops.object.select_all(action="SELECT")
bpy.ops.object.delete(confirm=False)
# add Text object, change to edit mode and set the string body
bpy.ops.object.text_add(align="VIEW", enter_editmode=True)
bpy.context.object.data.body = '\n'.join(lines)
print('\n'.join(lines) # for debugging
bpy.ops.object.mode_set(mode = 'OBJECT')
and I run the script by executing
echo -e 'hello\nworld\nI\nlike\nblender ' | blender -P ./script.py
the console output is as expected but the object data string is Text