Formation and Evolution of Cosmic Strings