A man who researched the Southport stabbings has been jailed for 30 years for the attempted murder of a nine-year-old girl.