Congress gave final approval on Monday to an emergency aid package of nearly $51 billion to help millions of victims of Hurricane Sandy, ending the legislation’s long and complicated odyssey.