Can't install OS X, shows a message to restart Macbook, repeats
Assuming that there is nothing more serious wrong with your computer, you should just be able to use either the recovery partition or internet recovery to install the OS. 

You can start the process by holding down Command-R when you restart and the computer should give you the opportunity to download a Mavericks installer. This should happen whether there is a recovery partition available or not. If no recovery partition is available, the computer should use internet recovery.

More information is here: http://support.apple.com/kb/ht4718

Also, it is unlikely that the Mac OS X 10.6.1 disc will work as new Macs will rarely allow old versions of the OS to be installed on them, although seeing a "screen of codes" seems less user-friendly than I would expect.