It is actually pretty simple. Make your exit text a button and add this code into your main menu script:
public void QuitGame()
{
Application.Quit();
}
Add the on click feature in unity then press the down arrow next to it then a name of your script you put it into will appear mine was "MainMenu" Then press the button that should say QuitGame()
Also I forgot to mention. I would add a Main Menu object to add your main menu script. I am not 100% sure but I think it won't work unless you do this.
I hope this helped! If you have any questions please ask!