What does setting boot-args kext-dev-mode do to set the serial port?
The command has nothing to with the serial port as such.

The "sudo" part means that you want to run the command that follows with superuser privileges.

The command is nvram, which is a command that allows you change variables in the NVRAM that is used by the firmware and kernel during boot of the computer.

The variable here is "kext-dev-mode" which is being enabled by setting it to 1. Ordinary kernel extensions (mainly drivers) must be signed by the developer, and the developers certificate needs to be signed by Apple - otherwise the kernel extension cannot be loaded.

The "kext-dev-mode" is intended for development scenarios where you want to test unsigned kernel extensions. Thus allowing these to be loaded without testing if they are indeed signed.

However, kext-dev-mode is no longer used for anything. On OS X El Capitan and newer it does absolutely nothing.