You must choose all the targets at the time you cast Put Away. You can’t use it to counter your own spell and then shuffle that card into your library because at the time you choose targets, the spell isn’t in your graveyard yet.

Artwork
Loading artwork…
Put Away
Shadowmoor · #48 · EN
Nonfoil—Foil—
Card rules
Counter target spell. You may shuffle up to one target card from your graveyard into your library.
Kithkin spellbottlers spend half their time preserving old memories and the other half punishing the new.
Common · Illustrated by Matt Cavotta
Format legality
Commander Legal
Duel Legal
Legacy Legal
Modern Legal
Oathbreaker Legal
Pauper Legal
Pauper Commander Legal
PreDH Legal
Vintage Legal
Alchemy Not Legal
Brawl Not Legal
Competitive Brawl Not Legal
Future Not Legal
Gladiator Not Legal
Historic Not Legal
Old School Not Legal
Penny Not Legal
Pioneer Not Legal
Premodern Not Legal
Standard Not Legal
Standard Brawl Not Legal
Timeless Not Legal
Tlr Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions
If the targeted spell can’t be countered, that spell will remain on the stack. Put Away will continue to resolve. If you targeted a card in your graveyard, you still get to shuffle it into your library.
If you choose to target a card in your graveyard, Put Away will have two targets. If either one of the targets becomes illegal, Put Away will continue to resolve and affect the other target.