Sorry,

fileOut.puts(histHash[i])

should be replaced with

fileOut.print("#{histHash[i]}\n")

Cheers,
Peter