Saving and loading into specific file?

I am trying to implement in my game my own load/save mechanic.

I want to save into a file the current game status everytime the player interacts with a savepoint event.

When the player dies, loses one live and in case lives>1 a list of previous savepoints is presented on
screen to choose one, the savepoint is loaded and then the new lives counter applied.

There is no 'load/save' menu, but the player can cast a spell to kill himself to force savepoint load
if lives>1;

Can someone guide me to to save and load from a specific file to implement something similar to:

saveGameIntoFile('./data/filename');

loadGameFromFile('./data/filename');

thanks

Original thread: https://forums.rpgmakerweb.com/threads/saving-and-loading-into-specific-file.116332/