Thermal energy harvesting device using ferromagnetic materials