Up to 40,000 well-wishers have gathered to pay their respects at a vigil for the 50 people who were killed in a terrorist attack in New Zealand.