function to read file and merge contents to list