TMIJS API TWITCH (Command !setGame ou !setTitle)

Then you need to load the data from the tokens file
Merge in the things you want to change
Then write the file back again

In your code you are nailing the ENTIRE file contents with the refresh token only

So something like (incomplete/semi pseudo codey)

if (res.statusCode == 200) {
    const res = JSON.parse(body);

    // load existing data
    let tokens = fs.readFile('./tokens.json');
    // override access token
    tokens.twitch.tokens.access_token = res.access_token;
    // override refresh token
    tokens.twitch.tokens.refresh_token = res.refresh_token;
    // write it all back to the file
    fs.writeFile('./tokens.json', JSON.stringify(tokens,null,4));

    // other stuff
}