The most basic example will be something like the following (haven't tested it, just typed on the fly):
Controller:
public with sharing class YourClass
{
public class CustomAccount
{
public String accountName {get; set;}
}
public List <CustomAccount> customAccounts {get; set;}
public YourClass()
{
customAccounts = new List <CustomAccount> ();
}
public void addNewRecord()
{
CustomAccount customAccount = new CustomAccount();
customAccounts.add(customAccount);
}
public void insertAccounts()
{
List <Account> accounts = new List <Account> ();
for (CustomAccount customAccount : customAccounts)
{
Account account = new Account();
account.Name = customAccount.accountName;
accounts.add(account);
}
insert accounts;
}
}
Page:
<apex:page controller="YourClass">
<apex:form id="form">
<apex:repeat var="customAccount" value="{!customAccounts}">
<apex:inputText value="{!customAccount.accountName}" />
</apex:repeat>
<apex:commandButton action="{!addNewRecord}" value="Add New" rerender="form" />
<apex:commandButton action="{!insertAccounts}" value="Insert All" rerender="form" />
</apex:form>
</apex:page>
It should get you started, at least to get the idea, then you can modify it as you need to.