As you write the sentences, there's very little difference in meaning.
Usually, the difference between present perfect and present perfect progressive is this: the progressive implies that the action is still continuing, or has only this second come to an end: "Where were you? I've been waiting for half an hour!" The present perfect without the progressive means the action is complete: "I've made a cake -- would you like a piece?"
The phrase "for the last two years" also means the action is still continuing. It's more natural to use the present perfect progressive, but you can sometimes use the present perfect instead. This is especially the case with verbs you don't normally use in the present progressive. For example:
We usually say "I live in London", not "I am living in London" (although that is also possible).
We can say either "I have lived in London for five years" or "I have been living in London for five years". It makes no difference.
In your example, though, we very often use "write" in the present progressive, so it's much better, in this case, to use the present perfect progressive.
If you omit the phrase "for the last two years", there is a very clear difference in meaning:
"He has written a novel" -> The novel is complete (and you can probably buy it, or at least he's sent the manuscript to the publisher).
"He has been writing a novel" -> The novel isn't finished yet, and he is still writing it.
student from ThailandGuest