Ah. I misunderstood. Sorry about that.
But to your actual question; if your code is not assigning anything to input_output, then no, it shouldn't.
Conceptually, this is what it should do.
iris <- iris # Original dataset
dt <- as.data.table(iris) # New assignment, etc.
dt <- dt[, Sepal.Length_m := mean(Sepal.Length), .(Species)] # Functionally similar