So to go straight the Angular Momemtum needs to 0?
Yes. But since this also means that the angular rates are zero, you can maybe see a simpler way to get to your goal.
So the torque is what is changing the direction, right
Yes. It changes how fast the attitude changes every second. But it is not the only way to change the attitude rates (you can also change the principal moments of inertia for changing them)
So then gimbal the engines to counter the torque?
Good idea, but still wrong understanding: If you gimbal the engines, you change the torque that they produce.
Correct understanding: If you have an attitude rate different to the one you actually want (for example zero), you gimbal the engines to produce a torque that changes the angular momentum and thus changes the attitude rates.
Now, you can of course calculate the needed torque with a complex mathematical model of your spacecraft and its dynamics. That is possible, but relies on you really knowing how your spacecraft is like.
Or you use a simpler adaptive function, that does not know your spacecraft well, but learns to provide good torque targets for your spacecraft. That is what a PID controller does.
The P or proportional part is essentially what is steering your spacecraft. You have a deviation (often called error in controller theory) and the reaction is a proportional reaction to that deviation.
The I or integral part makes the controller adaptive. It measures the accumulated difference between current rate and target rate and increases the output reaction as the accumulated error increases. It is also the component that can cause most problems in computer implementations.
The D or differential part allows you to dampen changes to the deviation. Either your own reaction by letting the spacecraft turn slower when a strong controller output might cause a strong overshoot past the target. or if some outside effect requires a fast reaction (for example turbulence of thrust oscillations, but also docking events). The D part reacts faster than the P component and muuuuch faster than the I part. But the D part can not make an existing error go to zero, it only reacts to changes to the error and tries to keep the error constant.
together, as sum of all three components, the PID function lets you calculate a good torque value that is maybe never perfect, but then also works good with very complex spacecraft. The PID function itself is simple, but the art is finding good coefficients for it. The function is adaptive, but like always, it works best in a region that it is defined by its coefficients for. The better you optimize the coefficients, the more precise and faster the reaction can be. But it also means that the PID function can even get unstable in some bad combinations of spacecraft state and change of attitude rates outside this optimized region.
Generally, a PID function only works for one axis. You need one each for pitch, yaw and roll. If you have strong changes in the spacecraft configuration, you also have special sets of PID functions for each configuration (think of staging of a rocket), so you always stay with your PID function in the state, that it works best.
The next step then would be, to take the output of the PID functions and let the thrusters react accordingly. If your bank PID function tells you to rotate to the left, you need to select the correct thrusters and gimbal them in the correct direction... the best way is to define this yourself, though there are magic functions around that calculate a solution for the available thrusters and the desired torque vector. These functions just need more CPU time and their flexibility is often not needed.