How to store & retrieve map information?

I have a minecraft-like mesh generator, but I also want to edit each coordinate in the chunk manually. Let’s say that for each xyz position in the level (up to, say, 20 in each direction), I want to specify:

  1. If there is a block or not (1 or 0)
    1. What Material the block, if there is one, has

This could be managed via a simple dictionary with the xyz position plus “filled?” or “material” or something, converted to string as the key, and returning the 0/1 or material.

I’d like to store this information in a database of sorts in a separate (txt) file. I know how to create and read from a file and find the line that corresponds to a coordinate, the txt file would look like this:

0,0,0 : 1, stoneMaterial

0,0,1 : 1, woodMaterial

However, I do not know how to replace/modify or add a line in the code (I only found the .NET append option), or if there is a better way to such kind of level information that can be trieved between games?

After two days of learning IO commands, I have managed to store my level information to a simple text file. The save function writes the txt file, with each line having “fields” seperated by blank spaces so they can be retrieved later in the load function. It’s a little bit messy here nad there but works flawlessly. However, I think I might just be able to do the same with the Unity Serializer.