I believe you meant to type "curve of degree m". Let's prove the "only if" direction first. If you can prove it for triangles then you can triangulate your $n$-gon and multiply together the expressions for each triangle. So let's assume $n=3$.

Now, pick coordinates $(t_0,t_1,t_2)$ on $\mathbb P^2$ so that the lines $t_i=0$ correspond to the three lines of your triangle, and let $at_0+bt_1+bt_2$ be a generic line that doesn't pass through any of your points. Consider the three functions $$f_i=\frac{t_i}{at_0+bt_1+ct_2}$$
on your degree $m$ curve. Weil reciprocity then tells you that $\prod_{P} (f_i,f_j)_P=1$ so you can write $$\prod_P (f_0,f_1)_P(f_1,f_2)_P(f_2,f_0)_P=1$$
and by the definition of the Weil symbol this ends up being exactly the product $\prod_{i=1}^n \prod_{j=1}^m \frac{\overline{B_{ij}A_i}}{\overline{B_{ij}A_{i+1}}}$ in your statement. I learned this proof here. Note that the result is true even if you let points coincide and count them with multiplicities.

To got the other way, omit one of the points and pick a degree $m$ curve through the remaining $3m-1$, by the calculation above the remaining point will be uniquely determined.