How should I repair these very damaged floor boards?
You'll never get it to match.  Even if you bought the exact same stain and exact same varnish, it still wouldn't match because the rest of the floor has aged.

The only real solution to this is to refinish the entire floor by sanding it down and re-staining.  While a lot of work, it is in the realm of do-it-yourselfers if you have the right tools and some patience. 

You mentioned an apartment - if you are a renter you should get permission from the landlord before you try any type of repair by yourself.