Creating A Post-Install Script That Installs Apps and Configures KDE?

My computer has not been running games that well recently (Like Dying Light native used to run now is black box, or games going to very low FPS after being in them for a bit). I would like to be able to create a script that can auto install my apps and configure KDE and latte-dock as well as the grub menu and I would upload this to github so any new installation I made I can just retrieve that script and run it. Is this possible and how would I be able to do this?