There has been a similar question before: How to convert a hexadecimal number to an octal number?
But, in my case I need an Algorithm to directly convert a number from Octal to Hexadecimal and back without converting it to binary/decimal as an intermediate step. Is it possible?
Use octal digits as hexadecimal ones and then just add the numbers you got with weights of $8^n$, working in hexadecimal.
For example: consider $a=347_8$. To get a hexadecimal representation without resorting to binary or decimal, you can use the fact that $8<16$, i.e. just take the digits as they are. Now you just do the computation:
$$\text{hex}(a)=7\cdot 8^0+4\cdot 8^1+3\cdot 8^2=7_{16}+20_{16}+\text{C}0_{16}=\text{E}7_{16}.$$
Keep in mind that you have to do the multiplication and addition in hexadecimal to fullfill your requirements to not leave hex/oct representation.