Executing task by task in pros

Hey guys. We just finished programming our pid loops: one for forward and backwards positions and another one for turning left and right. They both work fine. Now when we want to execute both of our tasks to form a trajectory for example going forward for a target position and then turning for a given angle, the robot behaves weird. We would really want to know how to execute our code task by task so that we can have our desired trajectory.
Thanks in advance.