Can you help me with TLG

I’ve pasted my solution to the tlg problem here can you please tell me where i made a mistake. Please spare a few minutes of your precious time to help a fellow engineer.

Thanks in Advance

Thank you but can you analyze my code it will help me a ton