If you click the "Insert code" formatting button, it's for inline code, like if you want to format a variable name inside a paragraph, like
this. It's not for multiline code blocks.
There isn't an option for multiline code blocks in Flarum's formatting toolbar. You need to manually start and end them with three backticks ``` (each set of three backticks must be on its own separate line).
For more details, search the web for how to format code blocks with Markdown. That's all it is. Just Markdown.