I understand that you are trying to check the stability of the given system for different values of lamda.
You can obtain the same by having an input vector containing the values of lamda. You may use a for loop to call the function you have written , for each value in the input vector lamda.
If you do not want to have a function call for each value in the input vector, you can vectorize the whole function. The following code might help for the given system, assuming that the number of lamda values used are 6.
Alternatively, you can directly use the 'isstable' function in matlab to get the stability of all transfer functions simultaneously , by passing a model array to the function. You may refer to the documentation to get a better idea on it.