Hi Diya-
Thanks for the question, this is a really common question for new WordPress users. There are a few ways to add scripts to your site, but you should not try to do it by modifying the theme files directly. The main reason I say that is because whenever you update your theme, your modifications will be overwritten.
Probably the easiest way to accomplish this is to install the Insert Headers and Footers plugin, which is trusted by over 1 Million websites. Once you’ve installed and activated that plugin, you’ll find a new menu under Settings, and you can simply paste your code into the Scripts in Footer section, which will insert it just above the </body> tag.