They needed to get to the Shrieking Shack. Because it was where Voldemort was, along with that blasted snake. However, it was easier said than done and navigating a school that Hermione could find her way through in her sleep, was difficult in the midst of a battle.