reads a file line by line, putting each line into an array