how do we know that the magnitude of B is going to be constant and its direction will be the same as a line element
We know that the magnitude is constant by symmetry. Since there is cylindrical symmetry (axisymmetric) the magnitude can only depend on $r$, and therefore cannot depend on $\theta$ or on $z$.
For the direction, that is a little more complicated. If we break $\vec B$ into $\hat r$, $\hat \theta$, and $\hat z$ components, then we see that the $\hat z$ component must be zero by symmetrybecause the Biot Savart law requires $\vec B$ to be perpendicular to $\vec I$. If the $\hat r$ component were nonzero then we would have a nonzero divergence which would violate Gauss’ law for magnetism. So only the $\hat \theta$ component can be nonzero. And its magnitude is determined by the integral you posted.