EDIT: I'm not very happy the the exposition below. But I hope you get the idea.
Your proof is correct. Given a principal bundle with connection having the given curvature, and a second connection on the same bundle a possibly different with the same curvature, since the space of connections is affine we get a 1-form on the base which measures the 'difference' difference between the two connectionsis a bundle with a flat connection (note that the category of $U(1)$-bundles with connection is a symmetric 2-group). Thus one gets an ambiguity in the choice of bundle and connection. This information is reflected in the short exact sequence
$$ 0 \to H^1(M,U(1)) \to \check{H}^1(M) \to \Omega^2_\mathbb{Z}(M) \to 0 $$
where the left cohomology group has discrete coefficients and classifies bundles with flat connections, and the group on the right is that of integral differential 2-forms on $M$. The central group is the ordinary differential cohomology of $M$. One way it may be thought of is as a moduli space (which has a group structure) of $U(1)$-bundles with connection. The right map is the map that sends a bundle with connection to its curvature form.
There is another short exact sequence dealing with the characteristic class of the bundle, see Proposition 1 at this nLab page. It describes the kernel of the (surjective) homomorphism $\check{H}^1(M) \to H^2(M,\mathbb{Z})$, sending a bundle with connection to its first Chern class (which one can think of as being a Cech class).

