Add semicolon to the end of each line when there is a dash on the next line

I am using Sunos. I thought that was considered unix?

: uname -a
SunOS ah5719006ub002 5.10 Generic_150400-64 sun4u sparc SUNW,SPARC-Enterprise

What does $!N do?

Can you explain what everything does please?