Meromorphic function with bounded order of zeros and poles

The following problem has been bothering me for a long time; Let $X$ be a compact Riemann surface of genus $g$. Is there a non-zero meromorphic function on $X$ with all of its poles and zeros have their (absolute value of) orders-i.e. multiplicities at most 2? I also require that the number of poles and zeros should be larger than $2g-2$ for each. I would like to use the Riemann-Roch theorem only, but I don't know how to apply the theorem sufficiently.

First of all, whenever we have an embedding $X \hookrightarrow \mathbf P^n$ into projective space, we get lots of meromoprhic functions of the kind you want, as follows:
Let $L_1$, $L_2$ be linear forms on $\mathbf P^n$ whose zero-sets are hyperplanes meeting $X$ transversely (or even with multiplicity 2 at some points): then restricting the meromorphic function $L_1/L_2$ from $\mathbf P^n$ to $X$ gives a meromorphic function $f$ on $X$ satisfying your multiplicity condition.
Next, you ask for the function to have more than $2g-2$ zeroes and poles. In the setup of the previous paragraph, that will be satisfied if $X$ is embedded in $\mathbf P^n$ with degree more than $2g-2$. (The zeroes and poles of $f$ are the intersections of $X$ with the zero sets of $L_1$ and $L_2$ respectively.)
To get an embedding with this property, apply Riemann–Roch to any line bundle $L$ on $X$ with degree at least $2g+1$. Riemann–Roch then implies (see Hartshorne Ch. IV for the details) that sections of $L$ give an embedding of $X$ into projective space, and the degree of the image is exactly $\operatorname{deg}L \geq 2g+1 > 2g-2$.