The phrase "had been living" is in the past perfect continuous tense.
As explained at edufind.com,
this tense is suitable "for actions that were going on in the past up until another action in the past happened."
In other words, at some point in the past, action A occurred, and before that, action B (the one in the past perfect continuous tense) was occurring.
When I read the sentence below, therefore, I expect it to be followed
by a description of an event that happened a few years after the girl
moved to China:
Then she moved to China and had been living there for a few years.
The event could be something that put an end to the action of living in China:
Then she moved to China and had been living there for a few years
when she moved back to Melbourne.
Alternatively, the girl might have continued living in China after the
other event:
Then she moved to China and had been living there for a few years
when she met An. Fifteen months later they were married and had rented
an apartment in Shanghai.
In fact, based solely on the statement that
"she moved to China and had been living there for a few years,"
it is possible that the girl is still living there.
For your intended meaning (that the girl lived in China but no longer does), I think it would usually be preferable to use the simple past tense, which is suitable "for actions starting and ending in the past." For example:
Then she moved to China and lived there for a few years.
Even this is not totally unambiguous, because sometimes people use the
simple past tense to describe an action that occurred during a period
of time in the past, but then state that the action occurred during a
subsequent period as well:
My head ached terribly before dinner. It ached terribly during and after dinner, too.
If the girl still lived in China, however,
you would more likely have written something like
Then she moved to China a few years ago and has been living
(or has lived) there ever since.
A way to eliminate any remaining ambiguity is to continue telling the
story of what happened next:
Then she moved to China and lived there for a few years.
Then she moved back to Melbourne.
Alternatively:
Then she moved to China and lived there for a few years,
but now she is back in Melbourne.