Please revert back to the code provided by Darshana. The duplicate problem is not happening on our dev site, so it could be something on your setup is doing that, please do testing for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it's fixed, you'll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.
Also, clear all your caching features/plugin (if any)
Let us know how it goes,