
ContentNote entity should be used to create Notes. ContentDocumentLink entity should be used to link it to the records.
Sample Code:
ContentNote objCN = new ContentNote();
objCN.Title = 'Test';
objCN.Content = Blob.valueOf( 'Testing Content' );
insert objCN;
ContentDocumentLink objCDL = new ContentDocumentLink();
objCDL.ContentDocumentId = objCN.Id;
objCDL.LinkedEntityId = '0018c00002H4wSIAAZ';//Hard coded account Id
insert objCDL;
Output:
