The back of my ankle hurts when I walk on it, but when I run on it it didn't hurt can you tell me what's wrong?

Possible bursitis. You may have bursitis ( an enlarged fluid sac on the back of the ankle) that would be fine when warmed up and running. Other possiblity of a pinched nerve that again when warmed up has no pain but hurts with simple walking. See your podiatrist for a thorough workup and treatment.
May . Have achilles tendonitis. Running the heel does not strike the ground the same as walking.
This is not . Uncharachteristic of achilles tendonitits. The diagnosis would be confirmed if indeed the discomfort is on the achilles tendon itself.