Finally I came to know of a command called screen which helps to create different type of sessions.
instead of using
'cmd &'
try using
'screen -d -m -s
in your script. This creates a detached session which runs in parallel as a separate process which can later be visited using the name given for the session.
There are many other options, look into 'man screen'.
Note: This command in the script works even when you have remote logged into the machine which has the script.