The gerund and present participle have the same form (-ing) but are different in use.
If it's part of a main verb, it's a present participle:
I am writing. (present participle)
The present participle can also be used as an adjective- an intersting film.
Writing in a foreign language is difficult. (gerund)
Here it is a gerund, functioning as a noun. It can be the subject or objec, or after a preposition.
- For Teachers