I doubt many will agree on the purpose of the second amendment, but I'd love to hear why everybody thinks the second amendment was written. Personally, I understand that it was put there so that we could take back our government if they get out of control.
Your understanding is wrong.
The Second Amendment safeguards an individual right to possess firearms pursuant to lawful self-defense – not to act in the capacity of law enforcement, not to fight crime, and not to ‘overthrow’ a government incorrectly and subjectively perceived to have become ‘tyrannical.’
The Framers did not amend the Constitution to authorize the destruction of the Republic they had just created.
Indeed, there’s nothing in Second Amendment case law that supports insurrectionist dogma, the wrongheaded notion that the Amendment authorizes citizens with small arms to ‘take back’ government gone ‘out of control’:
‘How crazy is the insurrectionist view that appears to be driving the opposition to expanded background checks, for fear of a national firearms registry, for fear of a totalitarian federal government? It's so crazy that even Justice Scalia, writing in
Heller, acknowledged that modern circumstances had severed the substantive protections of the Second Amendment from their original militia purpose, and by modern circumstances, he meant the preposterousness of insurrectionism. He said that "our standing army is the pride of our Nation" and stated (earlier in the opinion) that "it may be true that no amount of small arms could be useful against modern-day bombers and tanks."’
Dorf on Law: The Resurrection of Second Amendment Insurrectionism is "Ted Cruz Crazy"