if the value of a=0/b=0 or a=1/b=1 the output (y) will be same so we can use assign for only once but in this case a=1/b=0 or a=0/b=1 we can get two different outputs so we are using the two continuous assignment statements
Code
module top_module(input a,input b,output y );
assign y = a;
assign y = b;
endmodule;