When to choose "with doing this" or "by doing this"?
Very roughly:
by is correct. by, in this case, indicates the "how" something is done. i.e. we can create a safer community. How? by doing this.
with has many meanings none of which really fit here. They mostly describe a process or entity that is being done together with another process or entity.