Using Node Command in imperative Code Block

Hi,
i’m trying to iterate through a list of elements and creating filters based on the elements.
In the upper half screenshot example you can see what i expect the output to look like, I could now copy this line for all elements and their index, which would work but is quite tedious.

Instead I want to iterate throught the list using a while loop. Since this would only work in a imperative block, i tried to test this as seen in the lower half of the screenshot. Why does this return a nested, empty list? Shouldn’t the output be the same as in the upper half?

I managed to get what i want by using a different lacing on the ParameterFilterElement.ByRules Node outside of a Code Block. Still would be interesting to know why the above code behaves like it does though.