energies is an array of energies, so you need to subscript it in order to extract an energy from which you can get and print the value using the method inUnitsOf().
Thus, change the line
print energies.inUnitsOf(eV),'\t',dos[0,i],'\t',dos[1,i]
to
print energies[i].inUnitsOf(eV),'\t',dos[0,i],'\t',dos[1,i]
and you should be set to go! (Actually there are 2 places to change, for spin/non-spin.)