The goal of DOCTYPE html is to provide programmers and browsers with information at first glance of the Document Type Definition (DTD) and how a website should be rendered. The DTD indicates which code language is used on the page or in the HTML document. This applies, for example, to files in HTML, XHTML, SVG, MathML, or XML. So, if you learn HTML and want to create a website, you should insert as the first step.
If you don’t include the DOCTYPE declaration, websites may be displayed incorrectly. That’s because browsers automatically switch to “Quirks mode” if <!DOCTYPE html> is missing. This is to preserve the backward compatibility and presentation of websites that are behind in current code standards. At the same time, this can lead to things being incorrectly displayed despite current code, when browsers obey outdated, invalid code elements.