Du erstellst "newOption" als Standard DOM Element das keine jQuery Methoden wie .attr() und .text() unterstützt. Du kannst entweder JQuery nutzen
function test() {
var newOption = $('<option>').attr('value', 4).text("Neu");
$('#myselect').append(newOption);
}
oder alles in Vanilla Javascript.
function test() {
var newOption = document.createElement("option");
newOption.value = 4;
newOption.text = "Neu";
document.getElementById("myselect").appendChild(newOption);
}