An act of Parliament of 1854 sanctioned the amalgamation of the York, Newcastle and Berwick Railway, Leeds Northern Railway, York and North Midland and other lines into a new company with a railway network of over 700 miles .