Use nano to edit the .cfg like so:
sudo nano retroarch.cfg
Assuming that you’re in the folder that retroarch.cfg is in. Otherwise, find the file path to retroarch.cfg and place that after “sudo nano”
As for GPIO pins, there’s some diagrams on raspberrypi.org, and they’re quite confusing so you’ll probably have to reference it a lot.
If you have a Raspberry Pi A or B go to the following link:
https://www.raspberrypi.org/documentation/usage/gpio/
And if you have an RPi A+ or B+, or an RPi 2 board, go to this link:
https://www.raspberrypi.org/documentation/usage/gpio-plus-and-raspi2/