I installed CyanogenMod (Lollipop 5.0) on my Samsung Galaxy S5, but I want to go back to my original software on KitKat. Can anybody help me please?
Backup. Always do a nandroid backup (assuming you have CWM or TWRP since you have CM12.)
Download the appropiate firmware for your device which can be found here
Download Samsung Kies (during installation you will be prompted to install "developer" driver. Accept that.
Download odin here and then extract it to a folder of choice
Navigate to where you extracted odin and run it as administrator.
Now reboot your phone into download mode by first turning off your device completely and then turn it on again using three-button-combo: Volume Down + Home + Power at the same time.
If done correctly you should see a screen on your device that looks like this Now connect it using a usb cable to your computer.
After you've done that Odin should look somewhat like this:
Make sure you can see anything on the highlated area. If you cannot see it after 5 minutes you need to go back to step 3.
Now click the PDA/AP button and select the downloaded firmware using the window that pops out.
Make sure repartition is not checked and click start. Do not touch your device until an indicator says "PASS" or "RESET".
If your device is in a bootloop then boot into recovery and do a factory reset.
If your device is still in bootloop try again. If it still doesn't work then apply the nandroid backup you made.
NOTE: While Odin is doing stuff DO NOT UNPLUG THE USB CABLE!