I am trying to write a file to a directory that exists and is created by me in G:\\\\
i.e. not a system directory or in root drive
like this
This usually means that either there is a folder named "G:\Song", so you can't replace a directory with a file, or that your windows user account doesn't have permission to write to that drive.
Right-click on the drive and look at security permissions to be sure you have permission. Also, make sure the drive is not readonly, as in the case of a write-protected SD card or flash drive.