Ah!
line1 db 'Line1',0xa
line2 db 'Line2',0xa
line3 db 'Line3',0xa
line4 db 'Line4',0xa
line5 db 'Line5',0xa
len1 equ $ - line1
len2 equ $ - line2
len3 equ $ - line3
len4 equ $ - line4
len5 equ $ - line5
The '$' symbol (in this context) means approximately "here" - the current offset into the file - so "$ - line1" calculates the length of *all* your text. You need "len1" immediately after "line1", etc. for it to work. I suspected it must be something like that.
Not a bad way to do it, actually - print the whole thing with one sys_write... and then stop. Not very flexible, though. Ideally, I suppose you'd have just one "Line" as a literal, and calculate the number "on the fly" for as many lines as you need.
Running as root all the time is okay... if you're "careful". You can give the executable root permissions, even if the user isn't root, by doing (as root) something like:
chown root:root myfile
chmod +s myfile
Better yet would be to set the file permissions so you don't have to be root. I'm a little fuzzy how that works, but try "mov edx, 666q" ('q' is how Nasm indicates an octal number - 'o' or even 'O' will also work, but they look too much like zero for my taste!) Leaving edx "undefined" may not be a good idea.
Unless I'm mistaken, you can do "creat" and "open" in one shot, by "or"ing O_RDRW with O_CREAT (no 'E'!), and maybe "O_TRUNC" in ecx for the sys_open. (I'd have to look up the numbers for O_CREAT and O_TRUNC). In fact, I think you may be getting two file descriptors by doing both, but I'm not really sure.
There's a potential "bug" by not verifying that "argc" is 2 before proceeding. If the pesky user doesn't give a filename, I think it'll crash. It would be "polite" to print a "usage" message and exit cleanly. Personally, I consider a crash to be an emphatic, if non-verbose, error message, but it isn't the way we're "supposed" to do it.
I haven't tested your code, or "fiddled" with it, yet. I probably will - I learn a lot by playing with "other people's code"! I may be able to suggest other ways that it could be "improved".
To be able to get the filename from the command line, open it, and write anything at all is pretty good work for "day two", IMO! Keep at it and you'll go far!
Best,
Frank