Hi,
I am not totally clear on the objective of the task, but tiddlywiki itself uses a process to save an empty file. If you follow how this works on Tiddlywiki.com starting with the download empty button you can see it uses a template and within that a filter determines which tiddlers to download and their format, any tiddlywiki can generate an empty.html file. This can also be done via commands in NodeJS. One feature exports the Javascript separately rather than a single file. This template effectively encodes the way to save a whole wiki, thus arguably contains all the logic needed.
It is best to use tiddlywiki itself to load tiddlers into it, be it the node or single file wikis importing tiddlers. If you take the completely manual approach to edit the html you need to understand precisely the tiddler format (that's trivial) and where entries are to be stored in the html file. You will also see in the html file the tiddlers are stored in one place but they are often referenced by name in other parts only detail knowledge of the tiddlywiki structure can answer how and if you need to do more to add tiddlers directly.
I hope others can provide more info, but I hope this helps somewhat.
Tones