Not able to copy files to another Mac in the network via AFP
It turned out that the issue was indeed different UIDs though the usernames were the same. 

From the Apple Support Communities link:


  borbye:
  
  The first user that is established on an OSX disc is given UID number
  501. Normally next user is given UID 502. In my case I could not import my existing user during first run with my new MB Air. Had to
  establish a testuser and later import my existing user. It turned out
  that the testuser was giver UID 501 and my existing user was given UID
  502. Result was the existing users on the two macs are not the same even thoug the username and login is identical..


I tried what was suggested in the support thread and screwed up my entire system - as he had clearly warned.


  borbye:
  
  Check your users in systemprefs -> accounts - open the lock and right
  click on user -> choose advanced options.
  
  NB: Dont even think you can just change the UID for the user and it
  will work..... If some more advanced users have a script to change the
  UID for all files in a home folder, please let us know..


The workaround suggested at the thread didn't quite work for me. But I am not sure if I missed any steps. So you can try this at your own risk.


  one51mac:
  
  borbye is correct that this will remedy the problem but there is a way
  to do it and have your account work. after changing the user UID and
  group UID to 501 you will have to restart. then when you log on your
  home folder will still be your default but you will not have any
  access. Since you are still an admin you can change that. right click
  on the home folder and select get info click arrow for sharing and
  permissions. Your old UID account will show up as _unknown delete this
  user and add your user to it giving yourself read and write privilege.
  click on the cog on the bottom and select apply to enclosed items. A
  warning box will appear stating that this process cannot be undone do
  you wish to proceed? click yes and a status bar will come up. once the
  bar is gone the process is complete. since you didn't have access to
  your home folder you cannot save your settings, this is a good thing
  since your account will not look remotely the same as yours most
  likely. all you have to do now is logout and then back in. Your
  account will look as it did before the change with all the access
  settings and so forth as before the change... minus some permissions
  due to the overwrite. It's a minor repair to the permissions to some
  shares considering you will be able to now move files to and these
  shares without the permissions alert that only creates a 4kb file
  instead of the real thing. Takes 5 minutes at most. Have fun.


Ended up doing a fresh install and created a user with the same username as the first one. It took a lot of time to backup and restore all the data but finally I am back on track.