Ambipolar potential formation and axial confinement in TMX