I couldn't find any other way to create a share folder than creating it manually using PowerShell. This is what I did in my code. Thank you everyone for their replies.
- name: 'Create Folder shortcut on G: drive'
ansible.windows.win_shell: |
$WshShell = New-Object -ComObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("G:\\Folder1.lnk")
$Shortcut.TargetPath = "\\\\SERVER1\\Folder1"
$Shortcut.Save()