1."The school you are studying at is the largest one in this country"
This is the correct way to say it. You could easily get away with saying "The school you are studying in" and it will look natural to some native English speakers but it's not technically correct. It's a bit hard to explain when you should use "at" and when you should use "in", it's something you'll probably slowly pick up as you study English more and more.
2."Not all the books you can find in a library are good for you"
That one is correct. If something is good "for" you, that means using it will improve your body or mind. We often use it when talking about healthy food. Only a person can be good "to" you, as being good to someone means to be kind to them.
3."All the books he collected in his whole life were burned to ashes in a fire"
This is the correct one.
When a sentence could make sense without using the word "which" it is usually best to omit it or use the word "that" instead, as we do this often and over-using "which" can sometimes sound a bit unnatural to us.
"The school you are studying in" or "The school that you are studying in".
"Not all the books you can find in a library" or "Not all the books that you can find in a library".
"All the books he collected in his life" or "All the books that he collected in his life" - This isn't actually a sentence you can use "which" in at all, so you should use "that" or neither.
Using neither word usually sounds a little more natural than using "that", but you can use "that" without it sounding bad.
You weren't -wrong- to use "which" in the first two sentences, it just sounds a bit more natural if you don't.
Here's a few examples of sentences where "which" is perfectly natural to use:
"Chocolate or vanilla. Which do you prefer?"
"My parents are watching Game of Thrones, which is a very good show"
"Game of Thrones, which is a very good show, is being watched by my parents right now."
"This is a sentence in which using that word makes sense."