For a basic program, classes are completely useless. For a beginner programmer they just add extra complexity.
The larger and more complex a program becomes, the harder it is to find good names for all the methods. Classes help. Classes also allow grouping of similar types of code together to make the whole program easier to work with.
There are more reasons for classes, but that's outside of the scope of this basic introduction.
Just a dump of random crap
It's better to use
fileutils, if it exists.. this might be good only for some text files.
One of the giants that was released when I was initially interested in Ruby programming.