Hello Shivam,
In your function definition, you are calling : var[]
which forces the function to call itself at the rank value of 1. If you are looking for a list, then try changing that to : var[]..[]
which allows arbitrary rank.
As shown below:
d
You can find more information on DesignScript here: https://dynamobim.org/wp-content/links/DesignScriptGuide.pdf