How to set lag no.as variable to run loop in Lag column

In that case you have to use another node called Moving Aggregation.

See this post: Lag Column with Negative value? - #8 by Isabell

Alternative: this node

RB