The USA Patriot Act (Patriot being an acronym for "Uniting and Strengthening America by Providing Appropriate Tools Required to Intercept and Obstruct Terrorism") was passed in 2001 in the aftermath of the 9/11 terrorist attacks. As the name suggests, its purpose was to try to give law enforcement the tools that Congress felt it needed to prevent further terrorist attacks.
Basically speaking, the Patriot Act loosened restrictions on law enforcement. It made it easier for law enforcement agencies to search all sorts of records (including records of what people check out from libraries) belonging to people who are suspected of terrorist activity.
So you can look at the purpose in one of two ways. You can say it is meant to make it easier for law enforcement to pursue terrorist suspects or you can simply say that its purpose is to prevent terrorist attacks.