When will Earth's core die out? Will it die out when the sun dies out because it gets heat from the sun?
Unlikely and no.
Heat at the earth's core is sustained by two things, the downward pressure of everything above it, and, a large deposit of radio active material which also heats the core. The sun has absolutely no effect upon the heat at the core of the earth.
The sun's "death" will be preceded by it becoming a red giant. Many astronomers speculate that this expansion will great enough that the first three planets, which includes the earth, will be enveloped by the sun.
Even if the earth as a planet survived the red giant stage of the sun, the earth will be little more than a dead cinder moving around a dying star.