Herein means in this document or place. Herein described, the terms herein, herein lies the problem.
It belongs to legal and formal writing, alongside hereby, hereto and hereinafter, where its job is to point at the document itself without naming it. Outside that it survives in herein lies, which is deliberately grand. Note that the word is simply here plus in, and is as old as English.
1adverbhereinIn this document or place.
“The terms and conditions contained herein apply to all customers.”
herein is a formal reference.
Old English herinne is here plus in. Herewith, hereby and hereto are formed the same way.
Proto-Germanic
*hē₂rinna
Proto-West Germanic
*hērinna
Old English
hērinne
Middle English
here-inne
English, today
herein
From Middle English here-inne, her-in, her-inne, hier-ine, from Old English hērinne, from Proto-West Germanic hērinna, from Proto-Germanic hē₂rinna, equivalent to here + in. Cognate with West Frisian hjiryn (“herein”), Dutch hierin (“herein”), German hierin (“herein”), Danish heri (“herein”), Swedish häri (“herein”), Icelandic hér í (“herein”).
Etymology from Wiktionary, CC BY-SA