Increment Variable Maintain Padding

Hi guys, i’m working on a project that need to create increment line number everytime i hit a hot key. Let say i bind cmd-L for a hot key. when i press cmd-L it writes down line0001, the second time i press cmd-L it write down line0002 and so on up to line 0999. I’ve been struggling If and else for 12 hours now and couldn’t make it work :frowning: Any help is appreciated