However, my .bbl file remains empty. Oddly, when I replace write$ with top$ (as in the example from the manual), test does get output in the terminal. However, to make my example as true to the real use case as possible (and also because I want to know how it works), I would like to output my example string to the .bbl file.

Why does my .bbl file remain empty and what do I have to change so test gets output there?