Hello Ekzarov,
One question that I have for you is – What do you mean by making form as template to a library? Are you talking about SharePoint form library as template? If you have SharePoint form library as template and want to submit data to the library created using template you should have some code for Submit button which gets the SharePoint site address at the time of submit.
Hope this helps!