Hi ramitaherwahdan1978,
You need to import the necessary module to use mat-icon and to get rid of the errors you getting.
Use following commands to import it.
import { MatIconModule } from '@angular/material/icon'
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
Then, you have to use it in your module file.
For more details please refer the below links.
https://stackoverflow.com/questions/50190337/template-parse-errors-mat-icon-is-not-a-known-element
https://stackoverflow.com/questions/62168504/mat-icon-is-not-a-known-element-in-angular