As per your conditions may be this......

=IF(OR(AND(AA5>0,U5<0),AND(AA5<0,U5>0),AA5>U5),"Error",IF(U5<0,"LOAN","DEPOSIT"))