You need to read in your genre to write in your genre. You need to learn from the masters and know the conventions. You need to immerse yourself in the genre.
You don't want to get so deep in your reading that you start copying what you've read, however. You want your work to be original and innovative.
So how do you draw the line?
There are a few things you can do to help yourself.
Remember your intention. Have written down anything you planned for your story. If you know the ending, if you know the theme, if you have an angle that is truly original, write it down so you can call back to it while you're also reading the greats.
Read something else while you're writing. Sure, you want to be on top of your genre, but you can take a break while you're writing so that you don't end up accidentally copying what you're reading.
Be honest with yourself. If you find yourself copying someone else's style, writing with words that you usually wouldn't use, or copycatting an approach that you would never have thought of, be honest that you might be copying someone else.
You want to learn from other writers, but you want to make the lessons your own. Make sure that you aren't copying who is on your reading list and that you're being yourself in your writing.