For a project i made a 2 deminsional array which i had to store to a txt file

i done it by storing every element to a seperate txt file not the most effiecent way of doing it. I was wondering if anyone knows a way of puting the whole 2 dimenional array into 1 txt file?

just a wondering