How to make game data

I want to make game has function saving game data.

You know minecraft or any rhythm game, those game has game data in game direction
I want to make like that.

I can make game data as a organism of variable, but I don’t know how to export them into real file like
txt, database, that won’t deleted by exiting game and can load if we have that file.

How to export blueprint or variable like array into a real file(txt, database, any can load)
Then we can load game anytime when we have that save file in certain direction in game folder.