L wrote his name in the Death Note because he knew Light was going to get Rem to kill him so if he wrote his name in the other Death Note that would mean he has to come back to life to die again. Allowing him to finally prove once and for all that Light was actually Kira. L was very smart and he went to extremes by gambling his life on one guess that Kira and Light were one and the same. That is why L surpassed Light in intellect.

L was very crazy but truly a genius
