I think that could be a bracket issue:
if ((value('SM') == 1) or (value('SM') == 2) or (value('SM') == 3)) {
question('IN41');
} else {
goToPage('AND');
}
Else is maybe safer, in case the question SM has not been answered at all.
If you write "but it’s not working as intended" it would be helpful if you say, what happened exactly. Was there an error? Or was the outcome wrong?
Please also check, if your scale question has really the id "SM" - usually I would expect something like A001 (four digits).