A language model does not draft a whole answer and then hand it over. It runs a short cycle over and over. In each round it looks at everything written so far, assigns a probability to every token that could come next, picks one, and appends it. The appended token then becomes part of the input for the next round.
This is why generation feels like watching text appear rather than receiving a finished document. The model has no plan for the sentence's end when it writes the first word; the ending is decided later, one choice at a time, each choice made in the light of the choices already made. A stop condition, such as a special end-of-sequence token or a length limit, is what finally breaks the loop.