How to (properly) edit a file?

Hey! Trying to run a templater to scan all my files in a folder and remove done tasks.

I have the paths for all the files by calling:

app.vault.getAllLoadedFiles()

And now I find no way to load them into tp so I can read and update them.
I am tempted to use plain JS to read and write them (since I have the paths and the TFiles). But I guess thats not a good idea.

Anyone knows how to properly read and write files through app or tp?

Thank you!

Ended up doing it in python as described here: Daily Note templates for each weekday - #3 by Cito