You have to legally exit from Qatar, that is if you have RP visa. Otherwise, it is NOT ALLOWED TO HAVE RP in 2 different GCC Countries.

Good Luck!