Update different fields value of a entity based on the lookup selection field value using Plugin.

Hi Team,        (using Dynamics 365 Crm, Visual Studio 2017)

       I have two entity Account and B(Custom entity). and In the entity B has one lookup field (For this lookup field target entity is Account) ,Based on the selection of lookup field ; the other field of entity B should be  populate (ie. If I select any Account which one has some field a1,a2 then respectively value should come for field b1,b2 in entity B1). I want to do this "using Plugin".

        So, Please help me regarding this, i am new in Crm. Basically , i need business logic code for plugin.