Thanks a lot I got rid of the error
and the script worked fine if both the publisher and subscriber are on the same machine, however if the subscriber and publisher are on different machines It gave me the following errors
1.The process could not connect to the distributor
2. Login failed for the user 'NT AUTHORITY\ANONYMOUS LOGON
But If I use SSMS to synchronize database between publisher and subscriber it works fine.
I was just wondering why merge replication works in SSMS but it does not work when I use the above script.
Thanks
Gaurav