I can't understand why this function enter into a infinite loop as show in the Logs screenshot below ?!!!!
This only happens in run mode. In record mode everything working as expected !!!
In case anyone else encountered this problem. You have to edit your function and check the "has return value" box. Then your return will work. After this you have to use "Call Function" again and now you have a new field for saving results.
For multithreading you should use resources. There are additional
settings for each resource, just double click it inside resources pane.
There you can fine tune your settings to achieve desirable behavior.
In your case you should set resource to use each line only once,
and set max symultanious usages to 1. Check other settiings too
to make it work the way you want.