Hi nauna,
Check this example. Now please take its reference and correct your code.
HTML
<asp:ListBox ID="lstFruits" runat="server" Height="95px" Width="181px" SelectionMode="Multiple" onclick="MoveToTop(this)">
<asp:ListItem Value="1">Mango</asp:ListItem>
<asp:ListItem Value="2">Apple</asp:ListItem>
<asp:ListItem Value="3">Banana</asp:ListItem>
<asp:ListItem Value="4">Pineapple</asp:ListItem>
<asp:ListItem Value="5">Orange</asp:ListItem>
<asp:ListItem Value="6">Lemon</asp:ListItem>
<asp:ListItem Value="7">Guava</asp:ListItem>
</asp:ListBox>
<script type="text/javascript">
function MoveToTop(lst) {
var selected = new Array();
var options = lst.getElementsByTagName("OPTION");
for (var i = 0; i < options.length; i++) {
if (options[i].selected) {
selected.push(options[i]);
lst.removeChild(options[i]);
}
}
for (var i = 0; i < selected.length; i++) {
lst.insertBefore(selected[i], options[0]);
}
};
</script>
Screenshot