How to write this usb stick unmount command line properly?

You have to use the sync command before unmounting to be sure that the data is finished being written (wait for the shell to bring you back to the prompt, it can take several minutes, don’t assume that it’s stuck).

Doing a quick search, I found a blog post about a bash script to properly eject an USB device; it uses the udiskctl command. Maybe that’s the proper command for the one you had?