I'm guessing Hermione used Harry's death to turn his cloak into a horcrux? hence her taking it.
Author's response
Well, making a Horcrux requires a bit of preparation, then there's the actual ritual, followed by the sealing of the soul vessel -- oh wait! -- that's not supposed to be public information. Oops! My bad!
Let's just say that Horcruxing is not something you do on a whim or in a hurry. Not if you want it to last. And besides, Tom was standing RIGHT THERE. Hello? He might have objected ever so slightly.
I'm not really sure what Hermione's rationale was in taking the cloak. Maybe she thought it was cool or useful and it wasn't like Harry needed it anymore. Maybe she thought it was dangerous and she didn't want it to fall into the hands of the red-headed twin terrors.
The simplest explanation is that she didn't want to draw Tom's attention to it so she stuffed it into her pocket and proceeded to snog him, thus diverting his attention from such things as invisibility cloaks and boy-wizards lying dead on the floor. She needed time to figure out her next move and snogging is a proven method for keeping teenage boys from thinking -- about much of anything.
As far as living for a very, very long time, that wasn't via a Horcrux. Hermione accomplished that with a Mobius Time Loop. She tried to explain the theory to me once but my eyes glazed over after the second sentence.