Mill explained it happened by "mistake" while using a laptop belonging to Sheeran's co-writer Steven McCutcheon which "contains some unreleased material".
"I'm sure it won't happen again."
Earlier today, Sheeran sang to the High Court to prove he did not "steal" the chorus to his 2017 single Shape of You from another artist.
Sheeran has been accused of taking the song's Oh I, oh I, oh I hook from Sami Switch's 2015 song Oh Why, BBC News reports.
During his court appearance, he sang parts of Blackstreet's No Diggity and Nina Simone's Feeling Good to demonstrate how common the melody is.
"If you put them all in the same key, they'll sound the same," he explained.
The pop star denies having heard Sami Switch's song and has rejected the idea that friends might have played him the song before he wrote Shape of You in October 2016.
The pop track was 2017's best-selling single and is still the most-played song of all time on Spotify.
But his royalties have been frozen since copyright infringement was first claimed in 2018.
Lawyers played excerpts from the Shape of You recording sessions in court.
In one voice memo, Sheeran is heard saying he should change the "oh I" tune as it was "a bit close to the bone".
"We thought it was a bit too close to a song called No Diggity by Blackstreet," the star told the court. "I said that... we should change it."
Sheeran agreed that "fundamentally", the melody was similar to Sami Switch's song.
"They are based around the minor pentatonic scale [and] they both have vowels in them."
Andrew Sutcliffe, representing the writers behind Oh Why, then asked him, "It was a phrase you already had in your head after listening to the chorus of Sam's song, wasn't it?"
"No," Sheeran replied.
The trial continues.