Change your script to:
$(function(){
$("#txtResult").click(function(){
var firstNo = $("#txtFirstNo").val();
var arr = [];
if (firstNo.match(/^\d{5}$/)) {
arr.push("one");
arr.push("two");
}
else if (firstNo.match(/^\d{7}$/)) {
arr.push("three");
}
$("#txtPrint").text(arr.join("\n"));
});
});
Set the style on your output element so that line-breaks are preserved.
<p id="txtPrint" style="white-space:pre-line;"></p>
Demo[
^]