How to edit templates created in the block editor in code / template files not updating

You are obviously using full site editing theme if you have HTML templates. For classic themes you have PHP templates and there you can enter php code.

Full site editing html templates use only blocks in their templates and you can’t use PHP there. You can only use existing or build new block and place block template code there.

So either switch to classic theme, or use existing blocks in your theme to build a template or learn to develop blocks if existing block don’t fit your needs, which is more demanding than PHP development in classic theme templates.

tech