I was her biological teacher for 3 years she had been studying there
Or
I was her biological teacher for 3 years she had studied there
Also, in written situation it is best to write 3 years or three years?
I was her biological teacher for 3 years she had been studying there
Or
I was her biological teacher for 3 years she had studied there
Also, in written situation it is best to write 3 years or three years?
Before we get to verb tenses, there are actually a few other grammar problems with your sentences:
(for the following I'm assuming you meant to say that you were here teacher for the specific three years that she was there)
Now, as for verb tenses:
I was her Biology teacher for the three years she had been studying there.
This is actually the past perfect continuous (or past perfect progressive) tense. This is actually fine, and I would say is probably the most natural/correct way to say this, as it implies that the action (her studying) was taking place over some period of time, that it happened in the past, but it then finished.
I was her Biology teacher for the three years she had studied there.
This is actually the past perfect tense. It says that it took place in the past, but that it had already happened before some other thing in the past which we're talking about. In this case, it sounds a bit odd, because the only other thing in the past mentioned is the time you were her teacher, so what this actually seems to say is that she had already finished studying there before you were her teacher for the 3 years she studied there (which doesn't make a lot of sense).
However, if there is some larger context where you were already talking about some other past event which happened after all of this, the past perfect might make sense, to emphasize that her studying (and your teaching) happened before that other event instead. To make this clear it would be better to use the past perfect for both verbs, though ("I had been her Biology teacher...")
Note that in most cases where you can use a perfect tense (such as the past perfect continuous), you can usually also use the non-perfect tense (in this case past continuous), it just won't tell the listener quite as much about the relative timing of when things started or ended:
I was her Biology teacher for the three years she was studying there.
And in general, any time you're using any past tense, you can usually also just use the simple past, but this tells listeners the least amount of information about when things happened (it just says it happened some time in the past, nothing else):
I was her Biology teacher for the three years she studied there.
In this case, both of these are perfectly fine, too.
As for whether to use "3" or "three" in this case, there is no hard rule for this. Many style guides recommend spelling out numbers up to ten, and using digits for any numbers larger than ten (sometimes people will also spell out larger "round" numbers, such as twenty, fifty, etc). Because of this, if you're writing more formally (such as academically or for publication), it's generally good to spell out small numbers, as it can make things sound more professional. For more casual use, in general, nobody really cares much either way, though.