Largest common multiple equal or lower than max
Looping is generally not recommended in R.
And it's not really needed here.

As @vnp pointed out in a comment,
all you need is simply calculate the least common multiple of the values in the input vector, let's call it lcm, and apply the formula lcm * (max // lcm) (with integer division).

The pracma library already has an implementation of the least common multiple. If installing that library is not an option for you, you can use this instead:

gcd &lt;- function(a, b) {
  stopifnot(is.numeric(a), is.numeric(b))
  if (a &gt; b) gcd(b, a)
  else if (a == 0) b
  else gcd(b %% a, a)
}

Lcm &lt;- function(a, b) {
  stopifnot(is.numeric(a), is.numeric(b))
  a / gcd(a, b) * b
}


To calculate the least common multiples for a vector of numbers:

Lcm.many = function(values) {
  stopifnot(values)
  if (length(values) == 2) {
    Lcm(values[1], values[2])
  } else {
    Lcm.many(c(Lcm(values[1], values[2]), tail(values, -2)))
  }
}


Then with these helper functions the implementation of your function becomes much simpler:

LCMLthan = function(ms, max) {
  lcm &lt;- Lcm.many(ms)
  lcm * (max %/% lcm)
}


Update

As @flodel pointed out in a comment,
there's actually no need for Lcm.many at all,
the call to it can be simply replaced with Reduce(Lcm, ms):

LCMLthan = function(ms, max) {
  lcm &lt;- Reduce(Lcm, ms)
  lcm * (max %/% lcm)
}