Why should a lender record a mortgage that it has given a loan on?

https://b-ok.cc/book/1225779/037f5d
Why should a lender record a mortgage that it has given a loan on?
What does the Statute of Frauds require for a mortgage involving the transfer of real property or real estate?
What would give a lender the right to foreclose on a mortgage for which it has lent money?