In a conversation, where this sentence was needed, you would have been talking about Tom and Jim; so you might just say, "I did it for both."
Extend this to :
I did it for both of them.
I did it for both Tom and Jim.
You didn't 'do it both', you did it 'for both' as opposed to, "I did it for you."