Where the to-infinitive is a shorter way of saying "in order to" (i.e. expressing a purpose or goal), you cannot replace it with the -ing form.
"James made silly noises to annoy his brother." = ...in order to annoy... (=for the purpose of annoying)
"James made silly noises, annoying his brother." = ...with the effect of... (intentional or otherwise)
"He wasted a lot of time annoying his brother." (He wasted his time on annoying his brother. That's how he wasted it.)
"He wasted a lot of time to annoy his brother." (He wasted a lot of time, in order to annoy his brother. Annoying his brother was the purpose of the timewasting.)
"Looking through the catalogue, I found the product I was looking for." = While browsing... (In the process of)
"To find the product I wanted, I looked through the catalogue." (= In order to...)
In your example, if the intended meaning was "While creating" or "By creating", you could alter "To create" to "Creating". (You would change "assign" to "assigning", too.) But since the intended meaning is "In order to create", "for the purpose of creating", you should leave it as "To create".