You've really got two different questions. One is how to locate the insertion point; this involves a Regular Expression of greater or lesser trickiness depending on what else is happening in the string. The other is the mechanics of text insertion.
You don't say how the page is brought into being in the first place. CMS implies php involvement at some stage-- but what exactly do you see, and what does the text look like at the stage when you're adding this string?
four paragraphs, delineated by eight <p> marks
I hope that means four <p> marks and a further four </p> marks for a total of eight. Will the inserted text form a new paragraph-- call it 2b --or does it go at the beginning of the present paragraph 3?
For reasons 2c2e, I recently had occasion to insert the word "ferret" after every six words in an e-text. Interesting exercise. Next time I'll code it differently.