Yes, your understanding is correct. Clubbing A and B together, A will be just before B in (6-1)! or 5! arrangements.
However, to calculate the number of arrangements where A will be before B, we divide 6! by 2 as in exactly half the arrangements, A will be before B, and in the other half B will be before A.
Note also that the number of arrangements where A will be before B has to be greater than the number of arrangements where A is just before B. This is true (120 v/s 360).