A direct calculation of the free energy from the Bethe ansatz equation for the Heisenberg model