I can think of three ways to say "I remembered to put a pen in my bag"
I think all are technically correct but I'm not sure which is more natural.
Your first and second sentence are the same meaning. 忘れないで～する is a bit unnatural but 忘れずに～する is natural. And I feel the second one is more literary than the first.
The meaning of your third sentence are different from the others. This means "I put a pen in my bag and I didn't forget it."
ないで tends to sound like the negative imperative "Don't do X," so this one sounds a bit awkward, as if the 忘れないで is part of a quote from which we're missing the first half. While you can generally use ないで as a negative gerund, it typically doesn't imply causality with what comes afterwards. If you'd like to lead with some form of 忘れる here, you can use 忘れなくて as such:
If you're comfortable with it, you can also use ～ず here, simply replacing 忘れなくて with 忘れず[に]. Personally, I think ず is the best choice for this kind of sentence, but なくて functions just fine if you aren't there yet.
I think this is the most easily understood of the three sentences you've given us, but I'd suggest using の instead of こと when nominalizing 入れる:
To me "カバンにペンを入れることのを忘れなかった" sounds a little like you're talking about an experience rather than something abstract, like "I remember [didn't forget] going to put a pen in my bag," and I would somewhat expect to here some "but/however"-type clause follow. こと tends to sound like one is speaking of concrete events rather than abstract ideas (e.g. 食べたことありますか？), whereas の can be much more abstract.
This sounds like you put the pen in your bag and then didn't forgot about something while/because you were doing so. The "something" could be the placing of the pen or anything else depending on the context.
So both 1 and 2 can work, but I think sentence 2 is the most natural sounding.