It can't work because your function has no parameters and is applied to a property that doesn't even have keyframes nor would it actualyl do anything to generate a path without additional expression code. You have a major misunderstanding there.
Code works great before on other tasks like simple object moving but not here for some reason. I'm not sure if you saw the attached image, but i use keyframes on vector path which are moving and i need to loop that. Any recommendation what i can do to make it works? Or its simle not posible in AE to loop vector path?