I have a 4years boy. He has a severe cough. I gave to him aminophylline by rectal route and after 9 hours I gave him 2.5 ml of theophyline is that ok?

No. These two medications are similar and have a very small therapeutic window before having significant side effects. You should contact your medical provider immediately to discuss further.
Not best treatment. Aminophylline and theophylline are not my first recommendations for severe cough. They can be used to treat wheezing, but an inhaled bronchodilator, such as albuterol, is preferred because it works better and is safer. Go to the doctor immediately if he is having difficulty breathing or the cough is continuing.