9. Given the vectors $\vec{a}=(\sin x, 2 \cos x), \vec{b}=(\sqrt{3} \cos x-\sin x, \cos x), f(x)=2 \vec{a} \cdot \vec{b}-1$.
(1) If the equation $f^{2}(x)-(m+3) f(x)+3 m=0$ has four distinct real roots in $[0, \pi]$, find the value of $m$.
(2) Do there exist real numbers $a$ and positive integers $n$ such that the function $h(x)=f(x)-a$ has exactly 2023 zeros in the interval $[0, n \pi]$? If they exist, find all values of $a$ and $n$ that satisfy the condition; if not, explain why.
(1) $f(x)=2 \sqrt{3} \sin x \cos x-2 \sin ^{2} x+4 \cos ^{2} x-1=\sqrt{3} \sin 2 x+3 \cos 2 x$
$=2 \sqrt{3} \sin \left(2 x+\frac{\pi}{3}\right)$, and $f^{2}(x)-(m+3) f(x)+3 m=(f(x)-3)(f(x)-m)$,
When $f(x)=3 \Rightarrow x=0, \frac{\pi}{6}, \pi$, then $f(x)=m$ has a unique solution. Therefore, $m= \pm 2 \sqrt{3}$.
(2) From (1), when $a=3$, $n=1011$; when $a= \pm 2 \sqrt{3}$, $n=2023$.

When $a \in(-2 \sqrt{3}, 3) \cup(3,2 \sqrt{3})$, $f(x)=a$ has two zeros in each period, and $T=\pi$, so there does not exist a positive integer $n$ such that the function $h(x)=f(x)-a$ has exactly 2023 zeros in the interval $[0, n \pi]$.