There are two likely reasons why a customer would be unable to buy and sell a stock in the same trading day. For simplicity's sake, let's assume that you are trying to sell a stock that you own and buy a different stock that you wish to own, and that the account in which the securities are held is an unregistered, 100% cash, personal brokerage account that is restricted to all-long positions.
The most likely explanation for your situation is that your online brokerage will not let you day trade in your account due to your level of experience as a trader. Here is how the NASD defines day trading:
"For purposes of this rule, the term 'day-trading strategy' means an overall trading strategy characterized by the regular transmission by a customer of intra-day orders to effect both purchase and sale transactions in the same security or securities."
The other possibility is that the account does allow day trading, but it has a number of restrictions set up to prevent you from doing serious damage to your financial situation by over trading without understanding the risks involved. If you are a first-time investor, we can assume that your account has a number of restrictions on it that prevent you from investing in illiquid securities, extremely volatile securities, and so on. Because of the fee structures and complex regulations involved, brokerage accounts are usually set up with restrictions for beginner investors. Customers can ask to have these restrictions removed from their accounts. Depending on the brokerage firm and the customer's financial situation, the restrictions may be removed or loosened at the customer's request or after a given number of trades have been made.
If you continue to find your brokerage account too restrictive, you may want to shop around. Some online brokers are less restrictive on account activities than others. Depending on the brokerage, day trading can be defined as anything from making more than one trade in a day, to buying and selling the same stock in a day. Investigating your brokerage's policy on this matter may lead you to seek another online broker with less trading restrictions.
For further reading, see 10 Things To Consider Before Selecting An Online Broker, Choosing A Compatible Broker and Day Trading: An Introduction.
When a stock is sold in an account, the cash does not settle for 3 business days. In the business, it is called T+3 settlement. If there is no settled cash in the account and it is NOT a margin account, then the broker will not allow the same day purchase of another stock because there is no cash in the account and no provision to loan the cash for the 3 day settlement period. To do otherwise is referred to as "free riding" which is not allowed.