I'm trying to create a TM that changes all $a$'s to $b$'s and all $b$'s to $a$'s in a given string and then halts on the first blank space it encounters. What I have is:
$$ \langle q_1,a,b,q_1\rangle \\ \langle q_1,b,R,q_2\rangle \\ \langle q_2,a,L,q_1\rangle \\ \langle q_2,b,a,q_2\rangle $$
I'm new to Turing machines, so I'm wondering if it makes sense to convert $a$'s to $b$'s and then send $b$'s into a different state; is there a sort of temporal sequencing here that will send the $q_1$-manufactured $b$'s (former $a$'s) into $q_2$ as well? If so, how can you get around this problem to construct a suitable machine?