Paraphrasing L.I.Schiff, "Quantum Mechanics", the $S$-matrix $S=\langle \beta | \alpha^{+} \rangle $ is the amplitude of the asymptotic state $\beta $ contained in what became of an initial asymptotic state $\alpha $ after the scattering has taken place. So you should construct this for a complete set of states $\alpha $ and $\beta $. Evidently, you want to use a basis of energy eigenstates. In your case, this infinite-dimensional matrix decomposes into $2\times 2$ blocks on the diagonal, associated with given energy $p^2 /2m$, which indeed contain your amplitudes $\tilde{A} $ and $\tilde{B} $, namely, $$ S(p^2 )=\left( \begin{array}{cc} \tilde{A} (p) & \tilde{B} (p) \\ \tilde{B} (p) & -\tilde{A}^{*} (p) \tilde{B} (p) / \tilde{B}^{*} (p) \end{array} \right) $$ Your first question and the "Remark" following it are phrased a bit too sloppily. You have to distinguish between the asymptotic states for $x\rightarrow \pm \infty $. The incoming states are $e^{ipx} $ for $x\rightarrow -\infty $ and $e^{-ipx} $ for $x\rightarrow \infty $. The outgoing states are $e^{-ipx} $ for $x\rightarrow -\infty $ and $e^{ipx} $ for $x\rightarrow \infty $ (in that specific order, for the concrete matrix representation given).