function for reading file to list