Hi RK Naik,
Thanks for posting here.
>>>VSTS hosted agent Unable to get because a directory already existsa
Have you try to set the option Clean to true and Clean options to Source directory on the get source task? With this settings, VSTS will clean the source directory before get the source files:

Since this forum is about MSBuild, as you question is more related to VSTS, if above answer not help you, I suggest that you can open a new thread on the
stackoverflow with VSTS tag.
Hope this helps.
MSDN Community Support Please remember to click Mark as Answer. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.