Here's a Python script to create a very simple scribble file with a diagonal line from top right to bottom left. The coordinate origin on the page is at the top left - x increases across the page from left to right and y increases down the page from top to bottom. I've put a few comments in which should show what's going on.
Code:
from io import FileIO
from array import array
of=FileIO('1', 'w')
# Header
of.write(array('B', [0x0c, 0x04, 0x40, 0x06]))
# New linestring - each new linestring starts with this
of.write(array('B', [0xff, 0xff, 0xff, 0xff, 0x00]))
# 1st coord pair - loX, hiX, loY, hiY, 0x00
of.write(array('B', [0xae, 0x04, 0x00, 0x00, 0x00]))
# 2nd coord pair - loX, hiX, loY, hiY, 0x00
of.write(array('B', [0x00, 0x00, 0x32, 0x06, 0x00]))
# You can have as many coordinate pairs as you like in a linestring (>=2)
# Next linestring would start with [0xff, 0xff, 0xff, 0xff, 0x00] again
of.close()
Andrew