A cookie is a term that refers to the web message that web servers exchange with web browsers to identify a website and web user login information for customized web page access.
The main purpose of a cookie is to identify users and possibly prepare customized web pages or to save site login information for you.
As explained by webopedia.com:
When you enter a website using cookies, you may be asked to fill out a form providing personal information; like your name and email address. This information is packaged into a cookie and sent to your web browser, which then stores the information for later use. The next time you go to the same website, your browser will send the cookie to the webserver. The message is sent back to the server each time the browser requests a page from the server.
A web server has no memory so the hosted website you are visiting transfers a cookie file of the browser on your computer’s hard disk so that the site can remember who you are and your preferences. This message exchange allows the webserver to use this information to present you with customized web pages. So, for example, instead of seeing just a generic welcome page you might see a welcome page with your name on it.