Saving value in a txt file

hey guys, as you can see in this code below, I am able to generate a random value everytime I call this function. However, I want to be able to save the random number value generated in a txt file everytime I call this function in my void loop.

void keypadentrya()

randNumber = random(6100,8100);

///thensave randNumber value in txt file///


And the 'txt' file is where exactly ?