Let's assume that
Now, I would like to replace lines 40-50 from all of these files with a common set of 10 lines. Is this possible ?
It's not a html related topic. You should use a programming language.
By the way if your purpose is just to manipulate a bunch of classes/IDs and content, it's doable with javascript/jQuery. but unlike first solution it will run each time one of your html files are loaded in a browser. i don't recommend this.