Follow this guide. It has the basics of flashing stock Samsung firmware.
https://www.droidviews.com/install-stock-firmware-on-samsung-galaxy-devices-using-odin/
You pretty much find the firmware of your device (make sure it's the firmware for your device and cell service provider - if applicable, or you risk hard bricking) then flash it with the Odin tool.
If you plan on flashing different custom firmware in the future, make sure you install the correct version for your device. Some devices have a locked bootloader in some later firmware, that earlier versions don't have enabled - for whatever reason.