can i put rmiregistry and server programs in diff machines
Yes, you can run the registry on one machine and run server(s) on other(s). Just make sure that you spcify the codebase for the servers in a way that the registry can get to (i.e. - use a HTTP URL rather than a file.)
can we write a program for rmiregistry instead of normal rmiregistry
I'm sure that you could. It's basically just a Remote interface to something like a hashmap that lets you store and retrieve serialized references. To work with existing RMI programs you'd have to match the interface they provide - so I'm not sure how you could improve upon it too much. As a different approach, you could create a second level of interfaces/protocols/etc. on top of RMI - take a look at Jini for an example of this.