@
CursedLich and @
DeadKinginHell
My guess is that demon king and hero fight is just a stage play set up by the "gods".
At least one dies.
If one of them survives then the winner can live his/her life only for a limited time - to prevent one side (humans or demons) from becoming too strong and overpowering the other side.
So in order to avoid the balance being broken after the demon king or hero dies the "winner" is then bound to the librabry of the end as its new head librarian.
The library is probably connected to both the power of the hero and the power of the demonking or their sources and as such cannot be attacked by either side while functioning as the seal on the "winner" of the fight.
And why all that?
Well, I bet the "gods" have implemented this "hero vs. demon king" system to keep their believers at bay and continue to get "faith" as contribution to themselves.
The system works as follows:
The demon king appears and strengthens the demons and as such their faith in the demon god/ evil god who sent them the demon king.
--> The humans get desparate against the strengthened demons led by the demon king and hence start praying to their "gods".
--> The human's "gods" then send the "hero" into the world which garners them more faith from the humans who gain hope due to the hero's existence.
--> The hero and the demon king fight.
--> No matter who wins the "gods" gain even more faith because
A) The demon king wins, so the humans pray to their "gods" even more asking to be saved while the demons celebrate their demon king sent by their "demon gods" being the "winner".
B) The hero wins, so the humans celebrate their "gods" for sending the hero to their rescue and continue praying to them while the demons wish for revenge and pray to their "demon gods" to obtain that revenge by reviving the demon king / letting a new demon king be born.
--> But if the "winner" would remain in the world then their side would become too strong and could erase the other side.
--> Therefore after a certain amount of time or after their side has reached a certain strength the surviving hero or demon king will be bound to the library of the end and have his / her memories sealed.
So in short the "gods" of that world are treating the inhabitants (both humans and demons) like cattle to "farm" faith.
It could even be that there are not 2 different groups of "gods" to begin with.
It might be just 1 group of "gods" or maybe even just 1 "god" alone that plays different roles as "gods of the humans" and "gods of the demons".