With the help of following post I was able to edit the etc/hosts file inside the Android emulator.
The issue I am facing is that the moment I close the session after