Save and load string from text file

I get the error before I run the code. I added an edit “I can fix it with changing the normal int to int []but that wont work with my other code. Can I copy an int to an int[]?”

Would that work?