how to generate a public key(to be used in GitHub/GitLab) using command line [Git Bash].
The command below generates the error sh.exe\": syntax error near une
The command to run is only
ssh-keygen -t rsa -C "you@example.com"
All the rest beginning with line 2 of your script is the output of ssh-keygen.
And replace you@example.com with your email address.
Have a look at the manual for ssh-keygen to look for additional options. You should probably use a longer key by adding -b 4096 to the option list.