LocalSettings.php is probably not the right place for doing that.
Magic words are added using extensions.
However, magic words are really necessary only when the custom content that you want to add is so complicated that it can be generated only by complicated PHP code or when you need a convenient way to use the same functionality on many wikis.
If you need it only for one wiki, and the content is not exceptionally complicated, then it's quite possible that you can achieve the thing you want simply by creating a template on the wiki itself. Read more about it here:
Templates are written using the same wikitext as usual wiki pages. If you want to write it using an actual programming language, install the Scribunto extension, and write a module in Lua. See:
--
Amir Elisha Aharoni · אָמִיר אֱלִישָׁע אַהֲרוֹנִי
http://aharoni.wordpress.com“We're living in pieces,
I want to live in peace.” – T. Moore