Well I'm late but FFT lesson anyway: What happened to result in the long flat horizontal line in the green plot is because the entire sampled duration does not contain just the pure tone, but also includes another type of sound. For example starting recording before starting playback, ending playback before ending recording, or even just knocking on the equipment.
For example in this plot the peak looks slim and neat
View attachment 328192
But watch what happens when I include the silence:
View attachment 328193
Familiar shape isn't it
Moral of story: Cut away the silence part or any non-periodic part. The mathematics of FFT is such that it only works on a periodic signal.