Use a multi file find and replace tool.
Search for the tag immediately before or after where you want
to add the code and replace with that tag plus the code.
That assumes all your topics have the same relative path back
to the script. If not you will need to carry out several passes.
If you use something like FAR (www.helpware.net) you can
search for the style sheet at different levels. In some topics it
will be stylesheet.css, in others it will be ..\stylesheet.css and
so on. Use FAR to find each level and delete all other files from
the FAR list. (That only deletes the files from the list, not the
disk). You then have a list of topics at one level and use that for
the first find and replace.
Help others by clicking Correct Answer if the question is answered. Found the answer elsewhere? Share it here. "Upvote" is for useful posts.