What are $name and $level? If they are both strings, you just need to put a . in between them as a concatenation.
No you can not, even if the variables are defined correctly. Almost all functions in the PMMP API return a clone of the object you want to use, not the actual object. This means, that you have to remove the original item, and then add the renamed item to the inventory. If you don't do this, nothing will happen.