Basically if you create the token contract you can do whatever you want with the tokens. Your only restrictions are (if you want to be ERC20 compatible, that is, that your token is an ERC20 token) that you have to implement the ERC20 standard/interface.
When creating the contract it is quite typical to create all of the tokens and assign them to the creator for example. This can be done in the contract's constructor. After that you can just use the contract in a "normal" way to transfer the tokens wherever you wish.
Here for example is a rather typical token which utilizes OpenZeppelin's contracts. It sets the total amount of tokens and assigns them to the creator:
pragma solidity 0.4.24;
contract OwnToken is DetailedERC20
constructor(uint256 initialAmount, string _name, uint8 _decimals, string _symbol)
DetailedERC20(_name, _symbol, _decimals)
totalSupply_ = initialAmount;
balances[msg.sender] = initialAmount;