Hi @tushaar_srivastava,
I have create very simple workflow step that is doing what you need. It's using Sling api instead of JCR as this is what I prefer. Anyway, checked that code on my local environment and it works correctly.
Gets payload value as a root pathGets all child, grandchild etc pages, ...