NEW YORK—Ed Sheeran took the witness stand in a New York courtroom Tuesday to deny allegations that his hit song “Thinking Out Loud” ripped off Marvin Gaye’s soul classic “Let’s Get It On.” Sheeran, 32, was called to testify in the civil trial by the heirs of Ed Townsend, Gaye’s co-writer on the 1973 soul…