It's rather long. Skip to end if you want only to see some good practice :)
Also, to clarify one important thing first - anonimity and privacy are different things. If you're buying from exchange A, obviously the exchange knows your ID and that you're buying Monero so you're not anonymous. However, exchange can't tell what you're doing with the monero, so you keep your privacy and can later do anonymous shopping. Privacy is what enables you to be entirely anonymous, if you want.
Brief Overview of Monero Transactions
This is just for better understanding how transactions work. Imagine that every transaction creates brand-new one-time-use "pot" from which the owner can draw only once. Before you draw, you arrange yours together with some number of others' random pots (belonging to other, unknown wallets) and announce you're about to take from one of them. You approach each one and put your hand inside. At the end, you show your hand, and it contains a certificate (ring signature) saying you own something from one of the pots, and a key image saying you didn't draw from that pot before. All this without revealing which one of the displayed pots is yours. The network verifies that you have rights to take from 1 of them (but not which) - that's the ring signature.
Then, you make some brand-new ones, and distribute the value of your old one into them, usually 1 for the destination and 1 for the change back to yourself. You use invisible paint to mark some secret code on the pots. The recipe for the paint is given to you by the recipient, encoded into his address. Only the recipient has the special lens (view key) letting him find the pot. Without this, it is just some random pot. You gotta have the lens to be able to find it. For anyone else, it's an ordinary-looking pot, nothing special about it, no markings whatsoever. With the lens, he sees the secret marking, and that combined with his spend key lets him produce the certificate and draw from that pot when he's ready to spend.
I will not go into details how the amounts are hidden, but just accept it as fact that the secret marking tells you the amount as well and everyone else is able to verify you didn't cheat even though they can't see the amount.
So, only the sender and recipient know the amount and the secret code written to the pot. Sender knows because he's the one who wrote it (he could forget it forever, though) and the recipient knows because he can always look at all the pots with his special lens and see which ones light up as his (wallet scanning).
So, a wallet is just a collection of pots (one-time keys) from which you can spend exactly once. They all look like any other, but only the receiving wallet is able to identify which ones it has the rights to draw from. Only the spending wallet is able to identify which ones were used. The network would be able to tell if you try to use the same one again, but until you actually try. If it appears in a transaction, it will remain unknown if it was actually used, or it was someone else just putting your pot for display when spending from his.
Sending Directly from Exchange A to Exchange B
If you send directly from exchange A, then it's not you sending but the exchange. You only make the request via your browser. That means the exchange A is the actual sender (and not you) and knows both the amount and destination address, since you type it into exchange A interface.
If exchange B address is publicly known (and it usually is*) then A knows you want it to send to some exchange B. It can't tell whether it's to your own acconunt, or someone else's, unless it asks exhcange B "Hey, who's the user with payment ID XY?". Payment ID's are normally encrypted over "the wire", but since you practically gave it away to exchange A when using it's web interface, exhange A could tell if you repeatedly ask it to send to the same account at exchange B.
*even if B is using integrated addresses for deposits, it doesn't hide the underlying address, that's not the purpose of those.
The takeaway is: don't send directly from exchange to exchange.
Using Your Own Wallet Between Exchange A and Exchange B
You ask exchange A to send to your wallet and it does. Exchange A can't tell whether it's your wallet or not if the info is not publicly available. It just makes the "pot" with the paint (address) according to instruction. Since it made the TX, it knows what's written with the paint, even though it's with invisible paint.
Ok, but now you send to B. Firs, you have to source the funds. You arrange the pots for display, including the one A gave you. A is watching, and sees someone arranged 5 pots for display, and yours happens to be there. It could be someone else drawing from another one, or it could be you drawing from yours. A can't really know for sure. The destination is some other brand-new pots. Since A doesn't know which paint you used, it's just a random ordinary-looking pot. So, A has no idea to where the transaction was sent.
From A's point of view: maybe it was you who made the TX, maybe it was someone else. Regardless, the destination will be unknown, as well as the amount since there are 2 pots created, and A can't know how the amount was split or what it was.
So, the transactions are
A --> You (into pot P1) --> B (into pot P2).
Transaction spending P1 to make P, as it appears on the blockchain (notice no address :))
X2 ? ---> P2
Ok, so looks like you're good, and achieves what you're asking in the question.
Problem is only if A and B are sharing user data between them, or some adversary has user data from both of them. Then, A would know P2 is the result of transaction you made because it it has your account info at B, and it also appears in a TX using P1 as input.
The takeaway is: this is probably acceptable for daily commerce and average user, but not if you're getting monero from A and buying forbidden books from B, while E has infiltrated both A and B. In that case, E can get you.
Use Your Own Wallet, With Extra Distance
What if you make some random TX-es before sending to B?
A --> You (into pot P1) --> You (into pot P2) --> B (into pot P3).
Suppose both A and B are monitored by E, so it's really:
E --> You (into pot P1) --> You (into pot P2) --> E (into pot P3).
And the possibilities?
X2 ? ---> P2 --|
Y1 ?----> P3
Y3 ? ---> Z1 --|
So now B(E) doesn't know whether P2 is yours or someone else's. Also, E knows that maybe P2 came from P1 which she knows is yours. Maybe means there are 25 other possibilities (2TX-es, 5x5=25) which could also be true. Even if you never did a transaction to B, it could happen that B gets a false alarm that you could have. Any TX can include any "pot" so it's plausible.
So this is way better, don't you think?
For extra paranoia, do extra transactions beteween, and you're golden.
You can send to yourself as many times as you want, without anyone knowing you're actually doing it. Every such transaction (called "churn") puts you in a bigger crowd of possible senders. The more distance between any 2 TX-es, the more possibilities there are. At the same time, it increases the chance of others picking up your "pot" for display, and making even more fake trails without you having to do anything.
I think it's good to have 2 wallets. One you use to receive from A, and one you use to send to B. When moving your money from W1 to W2, be sure to send to yourself a couple of times whenever you're topping up W2, like:
A -> W1 -> W1 -> W2 -> B
You can spend repeatedly from W2 -> B. Just for topping up from A, it's good to do extra TX-es. If you're sending something from B, again do the intermediate cleaning, and use some W3 for sending back to A, like:
B -> W2 -> W3 -> W3 - A.
You can use any combination you want. If really careful, even one wallet will do, but it's easier to keep track what you do if you have more. What's important is to put some distance between A and B, that's all there is to it.
If you do some other transaction to some other party, it also counts as increasing distance between A and B, so if you're using monero regularly at various places instead of only A->you->B, maybe you don't have to do this extra steps