Based on this and this answer, here is what you need to do:
count_user_click = 0;
function addFields() {
if (this.count_user_click == 3) {
alert('too many times!');
}
else {
// increase counter
this.count_user_click += 1;
var container = document.getElementById("container");
// get the element with that id
let clone = document.querySelector('#tobecopied').cloneNode(true);
// Change the id attribute of the newly created element:
clone.setAttribute('id', 'new' + this.count_user_click);
// Append the newly created element on container
container.appendChild(clone);
}
}
<div>
<h2>Title</h2>
<div>
<mat-form-field appearance=outline id="tobecopied">
<mat-label>Title</mat-label>
<input matInput formControlName="Title" maxlength="35" required />
<br >
</mat-form-field>
</div>
<button onclick="addFields()">Add Line</button>
<div id="container" />
</div>
This was the easiest way I could see to achieve what you are looking for.
Good luck!