Welcome to functional programming

First of all your use case is possible with mutable map. You have using immutable map because that is by default available in Scala. Everything from the package scala.Predef is by default available in Scala and you don't need to import it by default.

In the last Scala repl notice the contents of the gMap. gMap contains the added item.

General code improvements

Do not use mutable collections unless you have a strong reason for using it.

In case of immutable collections new instance is returned when a operation to change the existing datastructure is done. This way the existing data structure does not change. This is good in many ways. This ensures program correctness and also ensures something called as referential transparency (read about it).

Contents are added to newMap and the old Map is not changed, stays intact. This is very useful because the code holding on to the gMap and accessing the gMap need not be worried about the changes happening to the underlying structure.(Lets say in multi-threaded scenarios, its very useful.)

Keeping the original structure intact and creating the new instance for changed state is the general way of dealing with state in functional programming. So its important to understand this and practice this.

In the above function definition there is no = after the closed parenthesis. This is deprecated in Scala 2.12. So don't use it because Scala compiler gives misleading compilation errors with this function declaration syntax.

Correct way is this.

def getUserInputs(lMap: Map[Int, String]) = {
lMap += (1-> "ss")
}

Notice there is = in this syntax.

Email codedump link for scala map in a method argument can not add key-value