Where do I put PHP to get a term ID?
That code won't work.  The first line is using the $tid to load the term, obviously that won't work if you don't know the Term ID in the first place.

You don't need to use any PHP to get a taxonomy terms ID. Just goto the edit page of that term and look at the url. It will be /taxonomy/term/TID/edit