Generating Table of content, Compile Headlines

Hello!
I need help please, because I don’t understand the system of scrivener properly yet.

First of all: When I compile a document, how can I manage the headlines of the different chapters? Do I have to write and format them in the different documents in my binder? Or is there a more elegant way?
How do I tell Scrivener, that any text string has to be handeled as a headline?

I am using 4 layers of headlines, i.e. 1 to 1.1.1.1
I need to specify which headline is in which layer. Each subpart has his own document in the binder so e.g. 1.1.2 is a singel document but also 1.1.2.1 and 1.1.2.2 are each single documents in my binder.

How can i generate a table of content out of it?

Thank you!!

Tobias

I have a similar question.

How do I get the titles of each page to appear as headings in my document when I compile? I tick of the heading in the compile window, but they do not appear when I make my pdf.