Create a secure SSH server with a static IP or DNS entry. It is important to set up keys and cache public key of destination server prior to these steps. There are many guides on doing this, so we'll skip over those.
Create a script with the following content. You can save it as /root/revese_ssh.sh for this example.
#!/usr/bin/env bash
REMOTE_PORT=22