How could I make an enchantment that applies an effect for infinite time, then removes when unequip

I'm trying to use Misode to do it, but I don't know exactly how I can make an infinite effect that is removed when the item is unequipped

Continue to help post