I see that companies are able to find whois data of newly registered domains? can I have information on how exactly is that done?
It depends, on the TLD.
For gTLDs, you can use ICANN CZDS which is a service giving you access to (almost) all gTLD registries zonefiles, updated once per day.
The zonefiles will contain all domain names published (caveat: not all domain names registered are published, voluntarily or not; the difference in amount should be small though, a few percentages), plus some extra data you can ignore.
For ccTLDs, some of them may also allow you to access daily list of newly registered domain names, you will have to check on each registry website. Here is an example for .FR ones: https://www.afnic.fr/en/products-and-services/services/daily-list-of-registered-domain-names/ (yes they are given as images and not text, in the hope to deter automatic scraping...) You may also have instead or in addition an open data initiative where you can get all data about existing domain names, however often not in real time.
Getting two set of data for two days and computing the difference gives you the list of newly added domain names, more or less. After which you can query them over whois to get all data (but you will surely be rate limited by registries if you do not take care on how you do it).
Alternatively, plethora of websites online do exactly the above for you, however not necessarily for free. Because what you are attempting to do is not a new idea, and has been done and redone. Since you do not provide data about why you are doing that, the answer is necessarily imprecise. You will clearly need to start by learning more about how domain names are structured industry-wise, what is a registry, a registrar, what role does ICANN play, what is the DNS, and zonefiles, etc.
There are also DNS "White/Black" listing of newly registered domain names, as some people like to use that fact as a metric if a domain is trustable or not (typically to score spam level of incoming emails). See this service for example: https://www.farsightsecurity.com/solutions/threat-intelligence-team/newly-observed-domains/