Here is the passage again:
To stay awake for a long evening of chemistry homework.
Beth made a huge pot of coffee. Unfortunately, her heart beat so fast and
her legs jiggled so violently that the poor girl couldn't concentrate.
The first part is an infinitive phrase fragment. It is missing a main clause, the most important component of a complete sentence.