On an affine scheme $\operatorname{Spec} A$, one can represent (*) any Cartier divisor as a formal $\Bbb Z$-linear sum of locally principal ideals $I\subset A$ which are locally generated by non-zero-divisors. As there are locally principal ideals which are not principal (the most accessible example being $(2,1+\sqrt{-5})\subset \Bbb Z[\sqrt{-5}]$), your guess of "a principal ideal generated by a non-zero-divisor" is not correct.
(*) In general, one may find Cartier divisors which cannot be written as a difference of effective Cartier divisors, which is the meat of the claim here. But since we are on an affine scheme, it trivially has an ample invertible sheaf and as discussed in Sasha's comment here this is enough.
(A quick aside: I really would recommend learning to deal with the sheaf side of things at some point. It's worthwhile.)