How do I Install macOS Sierra from Terminal in Recovery?
If you already have the Install macOS High Sierra.app application bundle, then the easiest way to install macOS is to create a macOS USB Installer and boot the Mac with it and install from there.  Have a look at: How to create a bootable installer for macOS

The startosinstall command that is within the e.g. Install macOS High Sierra.app application bundle is what you need to use:

$ /path/to/Install\ macOS\ High\ Sierra.app/Contents/Resources/startosinstall --usage
Usage: startosinstall

Arguments
--applicationpath, a path to copy of the OS installer application to start the install with.
--license, prints the user license agreement only.
--agreetolicense, agree to license the license you printed with --license.
--rebootdelay, how long to delay the reboot at the end of preparing. This delay is in seconds and has a maximum of 300 (5 minutes).
--pidtosignal, Specify a PID to which to send SIGUSR1 upon completion of the prepare phase. To bypass "rebootdelay" send SIGUSR1 back to startosinstall.
--converttoapfs, specify either YES or NO on if you wish to convert to APFS.
--installpackage, the path of a package to install after the OS installation is complete; this option can be specified multiple times.
--usage, prints this message.

Example: startosinstall --converttoapfs YES 
$


Note: The Arguments shown above I believe are when the --usage was done when running macOS normally, not from Recovery HD, so there may be some additional Arguments shown when run from the Recovery HD.

Here is an example of the command I used on one of my systems when booted from a macOS USB Installer with a separate copy of the Install macOS High Sierra.app application bundle on it:

/path/to/Install\ macOS\ High\ Sierra.app/Contents/Resources/startosinstall --agreetolicense  --volume /Volumes/Macintosh\ HD'


Note: The startosinstall command used was the one in the copy of the Install macOS High Sierra.app application bundle that I copied to the macOS USB Installer after it was created, not the one that gets written to the macOS USB Installer when it's created.