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.
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.