Leads despawn or break when you leave the chunk, same if you exit the world (at least last I checked). They're entities, and entities will not persist unless told to.
It's possible that you could use /summon LeashKnot with a persistent tag to make them stick, but I have no idea how you could connect it to an animal. If you just want it for fence decoration, that might work.
does anyone know why leads disappear when i go far away?
Leads despawn or break when you leave the chunk, same if you exit the world (at least last I checked). They're entities, and entities will not persist unless told to.
It's possible that you could use /summon LeashKnot with a persistent tag to make them stick, but I have no idea how you could connect it to an animal. If you just want it for fence decoration, that might work.