preg_replace('/(<p>[a-z]\).*<\/p>\s*<\/li>)/', '$1'."\n</ol>", $documento);
Explaining:
In the preg_replace function, the first parameter is the regex that should start and end with / within the regex, it is necessary to escape the characters that have a special meaning in the regex as) and / in this case, by adding a backslash before character, \ s represents space / tab characters / newline etc, should be used instead of the \ n you put, lastly put everything inside parentheses () to create a group, since that part should continue after replacement .
In the second parameter we put what will replace the selected text in the regex, in this case we must keep the group selected in the regex, to pick a group should use $ followed by the number of the group in ascending order starting with 1, and in the end we concatenamos the tag to be added.