According to Cambridge Dictionary:
but (conjunction): used to introduce an added statement, usually something that is different from what you have said before.
...
I'm sorry, but I think you're wrong when you say she did it deliberately.
...
The example given is quite similar to yours, and both phrases are and sound perfectly normal. I'm awfully sorry, but I haven't done my homework/assignment. sounds like the person is apologizing to whoever asked him/her about it, and letting him/her know that the homework/assignment was not done.
One workaround for your phrase could be I'm awfully sorry for not having done my homework/assignment., but be careful if you do choose to use this alternate phrase, because the context is different:
I'm awfully sorry, but I haven't done my homework/assignment.
The person who asked about the homework does not know it hasn't been done, it's unknown.
I'm awfully sorry for not having done my homework/assignment.
Either the person who asked about the homework knows it hasn't been done, and is scolding (for example) him/her, or it has been stated before.