Very new to the groovy.
I wanted to crawl all the pages in the site to get the links.
Can anyone help me with that script?
You could use third party tools for same. Check Xenu or similar -
Find broken links on your site with Xenu's Link Sleuth (TM)
Revert in case you still need groovy script..