Good question! The first thing you’ll need is a query to select just the tracks you’ll want to change. You can try out various queries with beet ls. Something like this could work:
beet ls title::'\d+'
That uses a regular expression query (you can read more in the docs about beets queries).
Then, you want to change the title to include the number. For that, you’ll need a feature that is only available in the latest beets source (see the FAQ for how to install from source) called formatted modify. That feature lets you do something like this: