The song was written for the movie, but John Ford hated the song and did not put it in. It was then released as a single.
As an odd sort of parallel, I thought, for instance, the theme from "Grease" should not have been in there, as it just didn't fit the film. But Pitney's song, with his distinctive voice, and the fiddle, would have been just perfect for "Liberty Valance"...
What a great thread!!