How can I run Drush 8 and Drush 9 together on same machine to test some module on it?
Install Drush 8 by downloading the phar file as recommended in the documentation. Rename the phar file to drush8, not drush.

Install Drush 9 as recommened in the documentation. I strongly recommend to install Drush Launcher globally using a phar file as documented and only install Drush site local. This is very easy if you are already using Composer to maintain your Drupal site. If you aren't using Composer to maintain your site, you can just as well install Drush 9 globally using Composer and forget about Drush Launcher.