When a new Mac is purchased you have to set up an Apple ID by using the gmail address ( you should keep Apple ID exactly same as gmail address see this article Create and start using an Apple ID - Apple Support
Then open apple mail application and configure with web mail account see this article Set up Mail on your Mac with email accounts - Apple Support
Mac users must also use iCloud account as it helps notes , contacts , reminders to configure with iCloud server if you create contacts in address book , or use reminders , notes etc they will always get saved see this article iCloud: What is iCloud?
And all passwords for Apple ID , iCloud id passwords are saved in iCloud Keychain .
First you have to set up and I cloud account for this see this article iCloud: Set up iCloud
See the 4 th point in the article you have enter in system preferences > internet accounts > in gmail account check the all four boxes of mail , contacts , calendars and notes .
Also you must set up iCloud Keychain see this article macOS Sierra: Set up iCloud Keychain
In this article - it is stating about iCloud security code you must save this code in records ( write down this in the diary it will remain constant for your account ) , as if in future if login keychain or iCloud Keychain is corrupted it will help you very much . In I cloud section all boxes are checked except back to my mac .
Note after configuration : All web mail address like gmail , Apple ID , iCloud ID and respective passwords see this article for creating good password macOS Sierra: Tips for creating secure passwords also another article macOS Sierra: Understand passwords your admin name and password , the very special of all " iCloud verification code " should be written in a safe place .
And while creating the Apple ID , security questions and answers are to be filled up , the birth date is also required , each and every question and answer must be written with you correctly .