Once you realise that awk's model is 'match pattern { do actions; }' everything makes a whole lot more sense.
BEGIN might be used to initialise Awk variables or print initial messages, while END can be used to print a summary of actions at the end.
See [1] https://www.grymoire.com/Unix/Awk.html#uh-1
Once you realise that awk's model is 'match pattern { do actions; }' everything makes a whole lot more sense.