I'm going to talk about US copyright law here.
By using a program illegally, I assume you mean that you have made an illicit copy. Making and using the copy is copyright infringement. If the copy is legitimate, it isn't infringing (it's legal to make copies as necessary for execution - such as copying from disk or SSD or optical drive to memory - as long as the copy is lawfully obtained). This infringement is not criminal itself, but it opens you to civil liability. The copyright holder could sue you. Assuming the copyright is registered (and it will be for commercial software), the suit could be for statutory damages, which can be quite high (up to $150,000 for willful infringement).
In practice, nobody is going to come after you for just making your own illicit copy, since it would be sufficiently difficult to prove it in court to not be worth it. The lawsuits about song copyright infringement were based on torrents. A torrent is a way of disseminating files with a peer-to-peer network, so that, in addition to downloading pieces of the file from others, the user is uploading pieces of the file to others. This is much easier to detect and prove. The downloading is as unlawful as the uploading (at least in the US), but the uploading is much easier to see and can provide probable cause.
However, you're proposing to make money from an illicit copy, which puts it in the category of criminal copyright infringement if the value of the software (and everything else you violate copyright law over in 180 days) is over $1000. It's doubtful that anybody would actually prosecute unless you made it attractive somehow, but it's possible.
If you're confident that you can make enough from the use of the program to buy a legitimate copy, you could try scraping up the money somehow and using a legit copy from the start, avoiding all the problems.