In is your input stream?
Yeah sorry I forgot, you need to pass into your function anything you want to use, so In needs to be passed in, and the variables you want to fill with data have to be passed in by reference so that they can be filled and returned
Code:
void getFromFile(ifstream In, string &CustName, string &AccountNum, string &Date, string &SName, string &Shares)
{
 getline(In, CustName); 
 In >> AccountNum; 
 In >> Date; 
 In >> SName; 
 In >> Shares; 
}
Call it with getFromFile(In, CustName, AccountNum, Date, SName, Shares) inside your loop in the main program.