No file format will save you by itself since at the end of the day, xml, json, etc they are all plain text.
One solution would be to use some database (like sqlite if you are just doing things locally on your computer).
Another solution would be to have a single process that is responsible for writing the data, while all other processes send messages to it via a queue.