"How do I run the command curl to achieve this ?"
You need to read the curl docs:
http://curl.haxx.se/docs/manpage.html
You also need to poke around a little. For example, point your browser at the router's configuration page:
1. Bring up the login page and copy down the URL
2. Right-click and 'view page source'
You want to look at the source to find out what happens when you enter a username, password, and click on the 'login' button. You will probably find a POST request will be sent. So, to log in (assuming you hadn't logged into the router yet), you need to use curl to send a similar POST. Of course you only need to automate this login if you are required to log in before you can be served the page with the WAN IP.
3. Go to the page with the WAN IP
Copy the URL. Also right-click and select 'view page source'. This time you're looking for the entry which has the WAN IP. You can then figure out the best way to parse that file and get exactly what you want. You can request the URL via a script using curl.
Other bits:
You may need to read up a bit on how to do a POST request, but odds are you just ape what you see in the router's web page source (what's executed when you click 'log in') and play with curl until you get that POST right.
If you do need to log in first, then you need to develop some trick to determine whether you are already logged into the router or not. Usually this is by sending a URL request and looking at the return value. For example, try selecting 'log out' of the router (from your 'admin' session, not from the ISP!), then typing in the URL that you copied and seeing what the router response is - for example, if it's "you need admin privileges" then you look at the source for the URL presented to you and see how it can be used to your advantage.