when you retrieve the value from the list
you do not save it to a variable
try
String name = list.get (nameCounter);
outputFile.println (name + ....
Also change this code
// Access the input and output files
try {
File inputDataFile = new File(INPUT_FILE_NAME);
Scanner inputScanner = new Scanner(inputDataFile);
} catch (FileNotFoundException e) {
System.err.println("Error opening file.");
}
File inputDataFile = new File(INPUT_FILE_NAME); //Access input
Scanner inputScanner = new Scanner(inputDataFile);
to
// Access the input and output files
Scanner inputScanner = null;
try {
File inputDataFile = new File(INPUT_FILE_NAME);
inputScanner = new Scanner(inputDataFile);
} catch (FileNotFoundException e) {
System.err.println("Error opening file.");
e.printStackTrace();
return; // no point in continuing
}