OP, I think you responded reasonably and probably not much differently than I would have in that situation. One of the "rules" of corrections nursing is "NO touching (without a darn good clinically indicated reason)!," at least it has been in my experience. Dressing a wound with medication? Absolutely. Rubbing God-knows-what onto an IM's shoulder for reasons known only to him? All the nopes.
If you get a chance to respond to the complaint, I would simply write that you were approached by an IM with this request, which you denied for reasons stated, e.g. unknown substance, not medically necessary, inappropriateness of request, etc; list alternatives offered to IM, and the fact that you consulted custody to approve what sounds to me like a satisfactory resolution.
IMs write people up all the time, often out of frustration that they haven't gotten their way. This sounds like one of those cases, so try not to worry too much until you have a reason to.