To add to rony's answer, the source is Bemidbar/Devarim Rabba. Thus, to cite this analysis by Aliza Moshe:
ופתחו וענו ה' אחד- "ה' אלוהינו ה' אחד" (דברים ו 4), מקור נוסף ל"ה' אחד" הוא במדבר דברים רבא- "... שאמר להם לישראל שיענו על כל דבור ודבור הן או לאו. והנה על 'אנכי ה' ענו הן רוצים אנחנו לקבל אלוהותו, אבל בדיבור השני 'לא יהיה לך אלוהים אחרים על פני' פחדו ונבהלו כי לא ידעו מה לענות, כי אם יאמרו לאו- יהא משתמע שאינם רוצים לקבלו עליהם, ואם יענו הן משתמע הן יהי לנו אלוהים אחרים ח"ו , לכן נתיישבו בדעתם וצעקו כולם 'ה' אחד' ".
It might be that they were at a loss by the second Dibra in particular. On the first one, they were able to say 'yes', but on the second one, a 'yes' might indicate that 'we have other gods', while a 'no' might indicate that they did not want to accept Hashem. Therefore, they abandoned the yes/no and instead said 'Hashem Echad'.
I was unable to locate (with minimal searching) the Midrash Rabba in question.
But I see rony's answer, with the detail that the first two were said with a single dibbur, based on a statement in the Zohar Chadash, and put together by the Belzer Rebbe:
על כל דיבור ודיבור אמרו ישראל הן הן לאו לאו שנאמר לאמר. "אנכי ולא יהיה לך בדיבור אחד נאמרו", (זוהר חדש סוף פ' יתרו), וזהו שנאמר בתהילים אחת דיבר א-להים שתים זו שמעתי, (גימטריאות לר"י החסיד ואתחנן). והנה בעת ששמעו בני ישראל את שני הדברות הראשונות בבת אחת נפחדו ונבהלו ולא ידעו מה לענות אם יענו "הן" יש לטעות בדבריהם ולהבין ח"ו שאמרו הן על הלאו ד"לא יהיה לך" ואם יענו "לאו" יש לטעות בדבריהם ולהבין שאמרו לאו על הדיבור "אנכי ה' אלקיך" שאינם רוצים ח"ו לקבל עול מלכותו ואחדותו ית"ש לזאת שמו עצה בנפשם וצעקו כולם פה אחד "ה' אלקינו ה' אחד" ודיבור זה עלה להם יפה על שני הדברות כפי שידוע שצריך לכוון בעת קריאת שמע ה' אלקינו "אנכי ה' אלקיך" ה' אחד "לא יהיה לך אלוהים אחרים" וזה מרומז במה שאנו אומרים בזמירות שבת "ובאו כולם בברית יחד נעשה ונשמע אמרו כאחד ופתחו וענו ה' אחד" (מהר"ש מבעלזא זי"ע).
The Jews answered "Yes, Yes", "No, No" to every one of the 10 Commandments, as it says "Leimor" (Shemot 20:1). '"Anochi" and "Lo Yiheye Lecha" were said at once', (Zohar Chadash end of Yitro), This is what it says in Tehillim "G-d spoke one, I heard two" (Gematriot of R' Yehudah HaChassid Va'etchanan). When the Jewish People heard the first two commandments simultaneously, they were afraid and confused and did not know how to respond. If they would answer "No" it could be mistakenly understood that they were saying "No" to the Commandment "I am the L-rd your G-d", as if they did not want to accept the yolk of Heaven and G-d's Unity (G-d Forbid). They found a solution to this by calling out as one, "The L-rd is our G-d, the L-rd is One". This statement worked well for both Commandments, as it is known that one must contemplate during Kriat Shema that "The L-rd is our G-d" corresponds to "I Am the L-rd your G-d", and "The L-rd is One" corresponds to "You shall have no other gods".
We hint to this when we say (in the Zemirot of Shabbat) "We all came with one covenant; we said as one, 'We will do and we will hear'; We opened and answered "The L-rd is One". - The Belzer Rebbe